Permalink
Browse files

refactor with opcode load_language

  • Loading branch information...
1 parent d5c4641 commit e002e938379ebdc21a70dade9433fd129f71ed45 @fperrad fperrad committed Nov 28, 2009
View
35 gil.pir
@@ -1,40 +1,16 @@
+
=head1 TITLE
gil.pir - A gil compiler.
=head2 Description
-This is the base file for the gil compiler.
-
-This file includes the parsing and grammar rules from
-the src/ directory, loads the relevant PGE libraries,
-and registers the compiler under the name 'gil'.
+This is the entry point for the gil compiler.
=head2 Functions
=over 4
-=item onload()
-
-Creates the gil compiler using a C<PCT::HLLCompiler>
-object.
-
-=cut
-
-.namespace [ 'gil::Compiler' ]
-
-.loadlib 'gil_group'
-
-.sub 'onload' :anon :load :init
- load_bytecode 'PCT.pbc'
-
- $P0 = get_hll_global ['PCT'], 'HLLCompiler'
- $P1 = $P0.'new'()
- $P1.'language'('gil')
- $P1.'parsegrammar'('gil::Grammar')
- $P1.'parseactions'('gil::Grammar::Actions')
-.end
-
=item main(args :slurpy) :main
Start compilation by passing any command line C<args>
@@ -45,15 +21,12 @@ to the gil compiler.
.sub 'main' :main
.param pmc args
+ load_language 'gil'
+
$P0 = compreg 'gil'
$P1 = $P0.'command_line'(args)
.end
-
-.include 'src/builtins.pir'
-.include 'src/gen_grammar.pir'
-.include 'src/gen_actions.pir'
-
=back
=cut
@@ -1,9 +1,10 @@
-.include 'src/builtins/math.pir'
-.include 'src/builtins/say.pir'
+.include 'gil/builtins/math.pir'
+.include 'gil/builtins/say.pir'
# Local Variables:
# mode: pir
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4 ft=pir:
+
File renamed without changes.
File renamed without changes.
View
@@ -0,0 +1,50 @@
+
+=head1 TITLE
+
+gil.pir - A gil compiler.
+
+=head2 Description
+
+This is the base file for the gil compiler.
+
+This file includes the parsing and grammar rules from
+the src/ directory, loads the relevant PGE libraries,
+and registers the compiler under the name 'gil'.
+
+=head2 Functions
+
+=over 4
+
+=item onload()
+
+Creates thegil compiler using a C<PCT::HLLCompiler>
+object.
+
+=cut
+
+.namespace [ 'gil::Compiler' ]
+
+.sub 'onload' :anon :load :init
+ load_bytecode 'PCT.pbc'
+
+ $P0 = get_hll_global ['PCT'], 'HLLCompiler'
+ $P1 = $P0.'new'()
+ $P1.'language'('gil')
+ $P1.'parsegrammar'('gil::Grammar')
+ $P1.'parseactions'('gil::Grammar::Actions')
+.end
+
+.include 'gil/builtins.pir'
+.include 'gil/gen_grammar.pir'
+.include 'gil/gen_actions.pir'
+
+=back
+
+=cut
+
+# Local Variables:
+# mode: pir
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
+
File renamed without changes.
File renamed without changes.
View
@@ -35,24 +35,25 @@ No Configure step, no Makefile generated.
# build
$P1 = new 'Hash'
- $P1['src/gen_grammar.pir'] = 'src/parser/grammar.pg'
+ $P1['gil/gen_grammar.pir'] = 'gil/parser/grammar.pg'
$P0['pir_pge'] = $P1
$P2 = new 'Hash'
- $P2['src/gen_actions.pir'] = 'src/parser/actions.pm'
+ $P2['gil/gen_actions.pir'] = 'gil/parser/actions.pm'
$P0['pir_nqp'] = $P2
$P3 = new 'Hash'
$P4 = split "\n", <<'SOURCES'
-gil.pir
-src/gen_grammar.pir
-src/gen_actions.pir
-src/builtins.pir
-src/builtins/math.pir
-src/builtins/say.pir
+gil/gil.pir
+gil/gen_grammar.pir
+gil/gen_actions.pir
+gil/builtins.pir
+gil/builtins/math.pir
+gil/builtins/say.pir
SOURCES
$S0 = pop $P4
- $P3['gil.pbc'] = $P4
+ $P3['gil/gil.pbc'] = $P4
+ $P3['gil.pbc'] = 'gil.pir'
$P0['pbc_pir'] = $P3
$P5 = new 'Hash'
@@ -64,6 +65,9 @@ SOURCES
$S0 .= ' gil.pbc'
$P0['prove_exec'] = $S0
+ # install
+ $P0['inst_lang'] = 'gil/gil.pbc'
+
.tailcall setup(args :flat, $P0 :flat :named)
.end
@@ -73,3 +77,4 @@ SOURCES
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4 ft=pir:
+

0 comments on commit e002e93

Please sign in to comment.