[svn:languages] r98 - in lolcode/trunk: . lolcode src
fperrad at svn.parrot.org
fperrad at svn.parrot.org
Sun Nov 22 18:50:08 UTC 2009
Author: fperrad
Date: Sun Nov 22 18:50:07 2009
New Revision: 98
URL: https://trac.parrot.org/languages/changeset/98
Log:
[lolcode] refactor with the opcode load_language
Added:
lolcode/trunk/lolcode/ (props changed)
lolcode/trunk/src/lolcode.pir (contents, props changed)
Modified:
lolcode/trunk/lolcode.pir
lolcode/trunk/setup.pir
Modified: lolcode/trunk/lolcode.pir
==============================================================================
--- lolcode/trunk/lolcode.pir Sun Nov 22 18:08:55 2009 (r97)
+++ lolcode/trunk/lolcode.pir Sun Nov 22 18:50:07 2009 (r98)
@@ -1,61 +1,17 @@
+# $Id$
+
=head1 TITLE
lolcode.pir - A lolcode compiler.
=head2 Description
-This is the base file for the lolcode 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 'lolcode'.
+This is the entry point for the lolcode compiler.
=head2 Functions
=over 4
-=item onload()
-
-Creates the lolcode compiler using a C<PCT::HLLCompiler>
-object.
-
-=cut
-
-.HLL 'lolcode'
-
-.namespace [ 'lolcode';'Compiler' ]
-
-.sub '' :anon :load :init
- load_bytecode 'PCT.pbc'
- .local pmc parrotns, lolns, exports
- parrotns = get_root_namespace ['parrot']
- lolns = get_hll_namespace
- exports = split ' ', 'PAST PCT PGE P6metaclass'
- parrotns.'export_to'(lolns, exports)
-.end
-
-.include 'src/builtins.pir'
-.include 'src/gen_grammar.pir'
-.include 'src/parser/yarn_literal.pir'
-.include 'src/gen_actions.pir'
-
-.sub 'onload' :anon :load :init
-
- $P0 = new 'ResizablePMCArray'
- set_hll_global ['lolcode';'Grammar';'Actions'], '@?BLOCK', $P0
-
- $P0 = new ['PAST';'Stmts']
- set_hll_global ['lolcode';'Grammar';'Actions'], '$?BLOCK_SIGNATURE', $P0
-
- $P0 = get_hll_global ['PCT'], 'HLLCompiler'
- $P1 = $P0.'new'()
- $P1.'language'('lolcode')
- $P0 = get_hll_namespace ['lolcode';'Grammar']
- $P1.'parsegrammar'($P0)
- $P0 = get_hll_namespace ['lolcode';'Grammar';'Actions']
- $P1.'parseactions'($P0)
-.end
-
=item main(args :slurpy) :main
Start compilation by passing any command line C<args>
@@ -66,11 +22,12 @@
.sub 'main' :main
.param pmc args
+ load_language 'lolcode'
+
$P0 = compreg 'lolcode'
$P1 = $P0.'command_line'(args)
.end
-
=back
=cut
Modified: lolcode/trunk/setup.pir
==============================================================================
--- lolcode/trunk/setup.pir Sun Nov 22 18:08:55 2009 (r97)
+++ lolcode/trunk/setup.pir Sun Nov 22 18:50:07 2009 (r98)
@@ -46,7 +46,7 @@
$P3 = new 'Hash'
$P4 = split "\n", <<'SOURCES'
-lolcode.pir
+src/lolcode.pir
src/gen_grammar.pir
src/parser/yarn_literal.pir
src/gen_actions.pir
@@ -56,7 +56,8 @@
src/builtins/math.pir
src/builtins/say.pir
SOURCES
- $P3['lolcode.pbc'] = $P4
+ $P3['lolcode/lolcode.pbc'] = $P4
+ $P3['lolcode.pbc'] = 'lolcode.pir'
$P0['pbc_pir'] = $P3
$P5 = new 'Hash'
@@ -68,6 +69,9 @@
$S0 .= ' lolcode.pbc'
$P0['prove_exec'] = $S0
+ # install
+ $P0['inst_lang'] = 'lolcode/lolcode.pbc'
+
.tailcall setup(args :flat, $P0 :flat :named)
.end
Added: lolcode/trunk/src/lolcode.pir
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ lolcode/trunk/src/lolcode.pir Sun Nov 22 18:50:07 2009 (r98)
@@ -0,0 +1,70 @@
+# $Id$
+
+=head1 TITLE
+
+lolcode.pir - A lolcode compiler.
+
+=head2 Description
+
+This is the base file for the lolcode 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 'lolcode'.
+
+=head2 Functions
+
+=over 4
+
+=item onload()
+
+Creates the lolcode compiler using a C<PCT::HLLCompiler>
+object.
+
+=cut
+
+.HLL 'lolcode'
+
+.namespace [ 'lolcode';'Compiler' ]
+
+.sub '' :anon :load
+ load_bytecode 'PCT.pbc'
+ .local pmc parrotns, lolns, exports
+ parrotns = get_root_namespace ['parrot']
+ lolns = get_hll_namespace
+ exports = split ' ', 'PAST PCT PGE P6metaclass'
+ parrotns.'export_to'(lolns, exports)
+.end
+
+.include 'src/builtins.pir'
+.include 'src/gen_grammar.pir'
+.include 'src/parser/yarn_literal.pir'
+.include 'src/gen_actions.pir'
+
+.sub 'onload' :anon :load
+
+ $P0 = new 'ResizablePMCArray'
+ set_hll_global ['lolcode';'Grammar';'Actions'], '@?BLOCK', $P0
+
+ $P0 = new ['PAST';'Stmts']
+ set_hll_global ['lolcode';'Grammar';'Actions'], '$?BLOCK_SIGNATURE', $P0
+
+ $P0 = get_hll_global ['PCT'], 'HLLCompiler'
+ $P1 = $P0.'new'()
+ $P1.'language'('lolcode')
+ $P0 = get_hll_namespace ['lolcode';'Grammar']
+ $P1.'parsegrammar'($P0)
+ $P0 = get_hll_namespace ['lolcode';'Grammar';'Actions']
+ $P1.'parseactions'($P0)
+.end
+
+=back
+
+=cut
+
+# Local Variables:
+# mode: pir
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
+
More information about the parrot-commits
mailing list