Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added -Bhoopl

  • Loading branch information...
commit d9fcbb684893ad973f943eb103ad7ffd7fd51119 1 parent f40db59
@pmurias pmurias authored
View
2  Makefile
@@ -21,7 +21,7 @@ srcunits=CClass Body Unit CgOp Op OpHelpers Sig RxOp NAME Stash STD \
NieczaGrammar Metamodel OptRxSimple NAMOutput Operator NieczaActions \
NieczaFrontendSTD NieczaPassBegin NieczaPassBeta NieczaPassSimplifier \
NieczaPathSearch NieczaBackendNAM NieczaBackendDotnet \
- NieczaBackendClisp NieczaCompiler GetOptLong
+ NieczaBackendClisp NieczaBackendHoopl NieczaCompiler GetOptLong
all: run/Niecza.exe obj/Kernel.dll obj/CORE.nam obj/CLRBackend.exe
@git describe --tags > VERSION
View
4 hoopl/nam.hs
@@ -6,9 +6,11 @@ import Data.Attoparsec
import Data.Aeson;
import Compiler.Hoopl
import Control.Monad.State.Strict
+import System.Environment
mainLineNam = nam . head . xref
main = do
- namSource <- (B.readFile "MAIN.nam")
+ [filename] <- getArgs
+ namSource <- (B.readFile filename)
let (Done rest r) = parse json namSource
let (Success parsed) = (T.parse (parseJSON) r) :: (T.Result Unit)
putStrLn $ show parsed
View
17 src/NieczaBackendHoopl.pm6
@@ -0,0 +1,17 @@
+use NieczaBackendNAM;
+class NieczaBackendHoopl is NieczaBackendNAM;
+
+# XXX XXX .NET doesn't seem to have any real spawnl functionality,
+# only system
+sub run_command($cmd, $args) {
+ Q:CgOp { (rnull (rawscall Builtins,Kernel.RunSubtask (obj_getstr {$cmd}) (obj_getstr {$args}))) };
+}
+
+method post_save($name, :$main) {
+ # None needed; run does all the work
+}
+
+method run($name) {
+ my $fname = $name.split('::').join('.');
+ run_command("hoopl/dist/build/niecza-hoopl/niecza-hoopl", "obj/" ~ $fname ~ ".nam");
+}
View
6 src/niecza
@@ -14,6 +14,7 @@ use NieczaPassSimplifier;
use NieczaBackendNAM;
use NieczaBackendDotnet;
use NieczaBackendClisp;
+use NieczaBackendHoopl;
use NieczaPathSearch;
use NieczaCompiler;
@@ -46,7 +47,7 @@ usage: niecza -e 'code' # run a one-liner
OR: niecza # interactive shell
general options:
- -B --backend=NAME # select backend (nam, dotnet, clisp)
+ -B --backend=NAME # select backend (nam, dotnet, clisp, hoopl)
-L --language=NAME # select your setting
-v --verbose # detailed timing info
-c --compile # don't run (implied with -C)
@@ -98,6 +99,9 @@ elsif $bcnd eq 'dotnet' || $bcnd eq 'mono' {
elsif $bcnd eq 'clisp' {
$backend = NieczaBackendClisp.new(obj_dir => $odir);
}
+elsif $bcnd eq 'hoopl' {
+ $backend = NieczaBackendHoopl.new(obj_dir => $odir);
+}
else {
note "Backend '$bcnd' not supported";
exit 1;
Please sign in to comment.
Something went wrong with that request. Please try again.