diff --git a/gil.pir b/gil.pir index cbe4ffd..0297c50 100644 --- a/gil.pir +++ b/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 -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 @@ -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 diff --git a/src/builtins.pir b/gil/builtins.pir similarity index 60% rename from src/builtins.pir rename to gil/builtins.pir index 321d2d5..7008956 100644 --- a/src/builtins.pir +++ b/gil/builtins.pir @@ -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: + diff --git a/src/builtins/math.pir b/gil/builtins/math.pir similarity index 100% rename from src/builtins/math.pir rename to gil/builtins/math.pir diff --git a/src/builtins/say.pir b/gil/builtins/say.pir similarity index 100% rename from src/builtins/say.pir rename to gil/builtins/say.pir diff --git a/gil/gil.pir b/gil/gil.pir new file mode 100644 index 0000000..155c1f0 --- /dev/null +++ b/gil/gil.pir @@ -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 +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: + diff --git a/src/parser/actions.pm b/gil/parser/actions.pm similarity index 100% rename from src/parser/actions.pm rename to gil/parser/actions.pm diff --git a/src/parser/grammar.pg b/gil/parser/grammar.pg similarity index 100% rename from src/parser/grammar.pg rename to gil/parser/grammar.pg diff --git a/setup.pir b/setup.pir index 37a073e..a3c2312 100644 --- a/setup.pir +++ b/setup.pir @@ -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: +