commit e7e4cf403d3b8752b709ec22db986a4e34160972 Author: Michael Zhang Date: Fri Dec 16 07:31:39 2022 -0600 initial diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7d029df --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +bin +.direnv +/result* diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..82c1fc8 --- /dev/null +++ b/default.nix @@ -0,0 +1,11 @@ +{ mkSilverBin, nix-gitignore }: + +mkSilverBin { + pname = "ableGo"; + version = "0.1.0"; + + src = nix-gitignore.gitignoreSource [ ./.gitignore ] ./.; + + grammarName = "io:mzhang:ableGo:compiler"; + javaFlags = [ "-Xss8M" ]; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..9935e9f --- /dev/null +++ b/flake.lock @@ -0,0 +1,88 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "id": "flake-utils", + "type": "indirect" + } + }, + "flake-utils_2": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "id": "flake-utils", + "type": "indirect" + } + }, + "melt": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1667881871, + "narHash": "sha256-Tf1NSz9p5JezcWFSmL/nrqoC8qSVFmqHQjnAAnV5uQs=", + "owner": "~remexre", + "repo": "melt.nix", + "rev": "e5c89aee04f575e08cf75e98009d1604db81844c", + "type": "sourcehut" + }, + "original": { + "owner": "~remexre", + "repo": "melt.nix", + "type": "sourcehut" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1666926733, + "narHash": "sha256-+gYfOEnQVISPDRNoWm2VJD5OEuTUySt48RchLpvm61o=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f44ba1be526c8da9e79a5759feca2365204003f6", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1667629849, + "narHash": "sha256-P+v+nDOFWicM4wziFK9S/ajF2lc0N2Rg9p6Y35uMoZI=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "3bacde6273b09a21a8ccfba15586fb165078fb62", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "melt": "melt", + "nixpkgs": "nixpkgs_2" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..abb0523 --- /dev/null +++ b/flake.nix @@ -0,0 +1,26 @@ +{ + description = "A very basic flake"; + + inputs.melt.url = "sourcehut:~remexre/melt.nix"; + + outputs = { self, nixpkgs, flake-utils, melt }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { + inherit system; + overlays = [ (final: prev: melt.packages.${system}) ]; + }; + + flakePkgs = rec { + ablego = pkgs.callPackage ./. { + inherit (melt.legacyPackages.${system}) mkSilverBin; + }; + }; + in rec { + defaultPackage = packages.ablego; + + packages = flake-utils.lib.flattenTree flakePkgs; + + devShell = pkgs.mkShell { inputsFrom = with packages; [ ablego ]; }; + }); +} diff --git a/grammars/io.mzhang.ableGo/compiler/Main.sv b/grammars/io.mzhang.ableGo/compiler/Main.sv new file mode 100644 index 0000000..80a786c --- /dev/null +++ b/grammars/io.mzhang.ableGo/compiler/Main.sv @@ -0,0 +1,11 @@ +function main +IOVal ::= args::[String] ioIn::IOToken +{ + local fileName :: String = head(args); + + local result :: IO = do { + return 123; + }; + + return evalIO(result, ioIn); +}