allison avatar allison committed 909ddb1

Add an HLL;Compiler wrapper for the compilation stages.

Comments (0)

Files changed (1)

 # Copyright (C) 2010, Parrot Foundation.
 
+.namespace [ ]
+
+.sub '' :anon :load :init
+    load_bytecode 'HLL.pbc'
+    load_bytecode 'Spix/PEG/Parser.pir'
+
+    .local pmc hllns, parrotns, imports
+    hllns = get_hll_namespace
+    parrotns = get_root_namespace ['parrot']
+    imports = split ' ', 'HLL'
+    parrotns.'export_to'(hllns, imports)
+
+    $P1 = get_root_global ["parrot"], "P6metaclass"
+    $P2 = $P1."new_class"("Spix::Compiler", "HLL::Compiler" :named("parent"))
+    $P2."language"("Spix")
+    $P1 = split ' ', "parse"
+    $P2.'stages'($P1)
+.end
+
 .sub 'main' :main
-    load_bytecode 'Spix/GrammarParser.pir'
-    load_bytecode 'dumper.pbc'
-    .local pmc parser
-    parser = new ['Spix';'GrammarParser']
-    $P0 = parser.'parse'("   ")
+    .param pmc args
+    $P0 = compreg 'Spix'
 
-    _dumper( $P0 )
+    $P2 = $P0.'command_line'(args)
+    .return ($P2)
+.end
 
+.namespace [ 'Spix'; 'Compiler' ] 
+ 
+.sub 'parse' :method 
+    .param pmc source 
+    .param pmc adverbs         :slurpy :named 
+    $P0 = new ['Spix';'PEG';'Parser']
+    .tailcall $P0.'parse'(source, adverbs :flat :named) 
 .end
 
 # Local Variables:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.