[svn:languages] r97 - in chitchat/trunk: . chitchat src

fperrad at svn.parrot.org fperrad at svn.parrot.org
Sun Nov 22 18:08:57 UTC 2009


Author: fperrad
Date: Sun Nov 22 18:08:55 2009
New Revision: 97
URL: https://trac.parrot.org/languages/changeset/97

Log:
[ChitChat] refactor with the opcode load_language

Added:
   chitchat/trunk/chitchat/   (props changed)
   chitchat/trunk/src/chitchat.pir   (contents, props changed)
Modified:
   chitchat/trunk/chitchat.pir
   chitchat/trunk/setup.pir

Modified: chitchat/trunk/chitchat.pir
==============================================================================
--- chitchat/trunk/chitchat.pir	Sun Nov 22 17:39:30 2009	(r96)
+++ chitchat/trunk/chitchat.pir	Sun Nov 22 18:08:55 2009	(r97)
@@ -1,55 +1,17 @@
+# $Id$
+
 =head1 TITLE
 
 chitchat.pir - A ChitChat compiler.
 
 =head2 Description
 
-This is the base file for the ChitChat 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 'ChitChat'.
+This is the entry point for the ChitChat compiler.
 
 =head2 Functions
 
 =over 4
 
-=item onload()
-
-Creates the ChitChat compiler using a C<PCT::HLLCompiler>
-object.
-
-=cut
-
-.namespace [ 'Transcript' ]
-
-.sub 'show:' :method
-    .param pmc arg
-    say arg
-.end
-
-.namespace []
-
-.sub 'onload' :anon :load :init
-    $P0 = newclass 'Transcript'
-    $P0 = new 'Transcript'
-    set_hll_global 'Transcript', $P0
-.end
-
-.namespace [ 'ChitChat::Compiler' ]
-
-.loadlib 'chitchat_group'
-
-.sub 'onload' :anon :load :init
-    load_bytecode 'PCT.pbc'
-
-    $P0 = get_hll_global ['PCT'], 'HLLCompiler'
-    $P1 = $P0.'new'()
-    $P1.'language'('ChitChat')
-    $P1.'parsegrammar'('ChitChat::Grammar')
-    $P1.'parseactions'('ChitChat::Grammar::Actions')
-.end
-
 =item main(args :slurpy)  :main
 
 Start compilation by passing any command line C<args>
@@ -60,15 +22,12 @@
 .sub 'main' :main
     .param pmc args
 
+    load_language 'chitchat'
+
     $P0 = compreg 'ChitChat'
     $P1 = $P0.'command_line'(args)
 .end
 
-
-.include 'src/builtins.pir'
-.include 'src/gen_grammar.pir'
-.include 'src/gen_actions.pir'
-
 =back
 
 =cut

Modified: chitchat/trunk/setup.pir
==============================================================================
--- chitchat/trunk/setup.pir	Sun Nov 22 17:39:30 2009	(r96)
+++ chitchat/trunk/setup.pir	Sun Nov 22 18:08:55 2009	(r97)
@@ -24,9 +24,9 @@
     load_bytecode 'distutils.pbc'
 
     $P0 = new 'Hash'
-    $P0['name'] = 'Chitchat'
-    $P0['abstract'] = 'Chitchat'
-    $P0['description'] = 'Chitchat'
+    $P0['name'] = 'ChitChat'
+    $P0['abstract'] = 'ChitChat'
+    $P0['description'] = 'ChitChat'
     $P0['license_type'] = 'Artistic License 2.0'
     $P0['license_uri'] = 'http://www.perlfoundation.org/artistic_license_2_0'
     $P0['copyright_holder'] = 'Parrot Foundation'
@@ -46,13 +46,14 @@
 
     $P3 = new 'Hash'
     $P4 = split "\n", <<'SOURCES'
-chitchat.pir
+src/chitchat.pir
 src/gen_grammar.pir
 src/gen_actions.pir
 src/builtins.pir
 src/builtins/say.pir
 SOURCES
-    $P3['chitchat.pbc'] = $P4
+    $P3['chitchat/chitchat.pbc'] = $P4
+    $P3['chitchat.pbc'] = 'chitchat.pir'
     $P0['pbc_pir'] = $P3
 
     $P5 = new 'Hash'
@@ -64,6 +65,9 @@
     $S0 .= ' chitchat.pbc'
     $P0['prove_exec'] = $S0
 
+    # install
+    $P0['inst_lang'] = 'chitchat/chitchat.pbc'
+
     .tailcall setup(args :flat, $P0 :flat :named)
 .end
 

Added: chitchat/trunk/src/chitchat.pir
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ chitchat/trunk/src/chitchat.pir	Sun Nov 22 18:08:55 2009	(r97)
@@ -0,0 +1,70 @@
+# $Id$
+
+=head1 TITLE
+
+chitchat.pir - A ChitChat compiler.
+
+=head2 Description
+
+This is the base file for the ChitChat 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 'ChiChat'.
+
+=head2 Functions
+
+=over 4
+
+=cut
+
+.namespace [ 'Transcript' ]
+
+.sub 'show:' :method
+    .param pmc arg
+    say arg
+.end
+
+.namespace []
+
+.sub 'onload' :anon :load
+    $P0 = newclass 'Transcript'
+    $P0 = new 'Transcript'
+    set_hll_global 'Transcript', $P0
+.end
+
+=item onload()
+
+Creates the ChitChat compiler using a C<PCT::HLLCompiler>
+object.
+
+=cut
+
+.namespace [ 'ChitChat::Compiler' ]
+
+.loadlib 'chitchat_group'
+
+.sub 'onload' :anon :load
+    load_bytecode 'PCT.pbc'
+
+    $P0 = get_hll_global ['PCT'], 'HLLCompiler'
+    $P1 = $P0.'new'()
+    $P1.'language'('ChitChat')
+    $P1.'parsegrammar'('ChitChat::Grammar')
+    $P1.'parseactions'('ChitChat::Grammar::Actions')
+.end
+
+=back
+
+=cut
+
+.include 'src/builtins.pir'
+.include 'src/gen_grammar.pir'
+.include 'src/gen_actions.pir'
+
+# Local Variables:
+#   mode: pir
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
+


More information about the parrot-commits mailing list