Author: pmichaud
Date: Mon Jun  4 12:04:43 2007
New Revision: 18805

Removed:
   trunk/examples/pge/p6parse.pir
   trunk/examples/pge/perl6.pir
Modified:
   trunk/MANIFEST
   trunk/compilers/pge/PGE/OPTable.pir
   trunk/examples/pge/README
   trunk/examples/pge/all.pir
   trunk/examples/pge/simple.pir

Log:
[pge]:
* Remove deprecated 'addtok' method from OPTable.
* Clean up examples/pge/ slightly (removing addtok and outdated
  examples).


Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST      (original)
+++ trunk/MANIFEST      Mon Jun  4 12:04:43 2007
@@ -611,8 +611,6 @@
 examples/pge/grammars/IO.pg                                 [main]doc
 examples/pge/grammars/PatchGrammar.pg                       [main]doc
 examples/pge/grammars/TAP.pg                                [main]doc
-examples/pge/p6parse.pir                                    [main]doc
-examples/pge/perl6.pir                                      [main]doc
 examples/pge/simple.pir                                     [main]doc
 examples/pir/circle.pir                                     [main]doc
 examples/pir/euclid.pir                                     [main]doc

Modified: trunk/compilers/pge/PGE/OPTable.pir
==============================================================================
--- trunk/compilers/pge/PGE/OPTable.pir (original)
+++ trunk/compilers/pge/PGE/OPTable.pir Mon Jun  4 12:04:43 2007
@@ -610,73 +610,6 @@
 #           to be determined by the caller)
 #
 
-=item C<addtok(string name, string rel [, string opts [, pmc match]])>
-
-Deprecated.  Use C<newtok>.
-
-=cut
-
-.sub "addtok" :method
-    .param string name
-    .param string rel          
-    .param string opts         :optional
-    .param int has_opts        :opt_flag
-    .param pmc match           :optional
-    .param int has_match       :opt_flag
-
-    .local pmc args
-    args = new .Hash
-
-  addtok_rel:
-    if rel == '' goto no_precedence
-    $S0 = substr rel, 0, 1
-    if $S0 == '<' goto looser
-    if $S0 == '>' goto tighter
-    args['equiv'] = rel 
-    goto addtok_opts
-  looser:
-    $S0 = substr rel, 1
-    args['looser'] = $S0
-    goto addtok_opts
-  tighter:
-    $S0 = substr rel, 1
-    args['tighter'] = $S0
-    goto addtok_opts
-  no_precedence:
-    args['precedence'] = '='
-
-  addtok_opts:
-    if has_opts == 0 goto addtok_match
-  addtok_right:
-    $I0 = index opts, 'right'
-    if $I0 < 0 goto addtok_list
-    args['assoc'] = 'right'
-  addtok_list:
-    $I0 = index opts, 'list'
-    if $I0 < 0 goto addtok_nows
-    args['assoc'] = 'list'
-  addtok_nows:
-    $I0 = index opts, 'nows'
-    if $I0 < 0 goto addtok_nullterm
-    args['nows'] = 1
-  addtok_nullterm:
-    $I0 = index opts, 'nullterm'
-    if $I0 < 0 goto addtok_match
-    args['nullterm'] = 1
-
-  addtok_match:
-    if has_match == 0 goto end
-    $I0 = isa match, 'Sub'
-    if $I0 goto add_parsed
-    args['match'] = match
-    goto end
-  add_parsed:
-    args['parsed'] = match
-
-  end:
-    .return self.'newtok'(name, args :named :flat)
-.end
-    
 =back
 
 =cut

Modified: trunk/examples/pge/README
==============================================================================
--- trunk/examples/pge/README   (original)
+++ trunk/examples/pge/README   Mon Jun  4 12:04:43 2007
@@ -8,7 +8,6 @@
    all.pir - program that demonstrates a variety of parses using PGE.
      Includes:  
        simple.pir - parser for simple mathematical expressions (<Simple::expr>)
-       p6parse.pir - Perl 6 expression parser (<Perl6::expr>)
 
 
 Start by running "all.pir".  To parse simple mathematical expressions
@@ -18,12 +17,6 @@
 
 and then enter mathematical expressions after that.
 
-To parse Perl 6 expressions, enter
-
-    rule <Perl6::expr>
-
-and then type in p6 expressions to see the resulting parse.  
-
 Note that this is all a work in progress, so some features might
 not be working yet.
 

Modified: trunk/examples/pge/all.pir
==============================================================================
--- trunk/examples/pge/all.pir  (original)
+++ trunk/examples/pge/all.pir  Mon Jun  4 12:04:43 2007
@@ -15,7 +15,6 @@
 
     print "loaded p6rule\n"
     "loadexpr"("Simple", "expr")
-    "loadexpr"("Perl6", "expr")
 
     p6rule = compreg "PGE::P6Rule"
     cmdpat = p6rule("^(rule|next|trace|pir)\\s*(.*)$")
@@ -94,7 +93,6 @@
 .end
 
 .include "simple.pir"
-.include "p6parse.pir"
 
 # Local Variables:
 #   mode: pir

Modified: trunk/examples/pge/simple.pir
==============================================================================
--- trunk/examples/pge/simple.pir       (original)
+++ trunk/examples/pge/simple.pir       Mon Jun  4 12:04:43 2007
@@ -11,31 +11,31 @@
     store_global "Simple", "$optable", optable
 
     p6rule = compreg "PGE::P6Rule"
-    term = p6rule("\\d+ | <ident>", "Simple", "term")
+    term = p6rule("\\d+ | <ident>", 'grammar' => "Simple", 'name' => "term")
 
-    optable.addtok("infix:+")
-    optable.addtok("infix:-", "infix:+")
+    optable.'newtok'("infix:+", 'precedence' => '=')
+    optable.'newtok'("infix:-", 'equiv' => 'infix:+')
 
-    optable.addtok("infix:*", ">infix:+")
-    optable.addtok("infix:/", "infix:*")
-    optable.addtok("infix:%", "infix:*")
+    optable.'newtok'("infix:*", 'tighter' => 'infix:+')
+    optable.'newtok'("infix:/", 'equiv' => 'infix:*')
+    optable.'newtok'("infix:%", 'equiv' => 'infix:*')
 
-    optable.addtok("prefix:+", ">infix:*")
-    optable.addtok("prefix:-", "prefix:+")
-    optable.addtok("prefix:!", "prefix:+")
+    optable.'newtok'("prefix:+", 'tighter' => 'infix:*')
+    optable.'newtok'("prefix:-", 'equiv' => 'prefix:+')
+    optable.'newtok'("prefix:!", 'equiv' => 'prefix:+')
 
-    optable.addtok("infix:**", ">prefix:+")
+    optable.'newtok'("infix:**", 'tighter' => '>prefix:+')
 
-    optable.addtok("postcircumfix:( )", ">infix:**", "nullterm")
+    optable.'newtok'("postcircumfix:( )", 'tighter' => "infix:**", 'nullterm' 
=> 1)
 
-    optable.addtok("term:", ">postcircumfix:( )", "left", term)
-    optable.addtok("circumfix:( )", "term:")
+    optable.'newtok'("term:", 'tighter' => 'postcircumfix:( )', 'parsed' => 
term)
+    optable.'newtok'("circumfix:( )", 'equiv' => 'term:')
 
-    optable.addtok("infix:==", "<infix:+")
-    optable.addtok("infix:!=", "infix:==")
+    optable.'newtok'("infix:==", 'looser' => 'infix:+')
+    optable.'newtok'("infix:!=", 'equiv' => 'infix:==')
 
-    optable.addtok("ternary:? :", "<infix:==", "right")
-    optable.addtok("infix:=", "<ternary:? :", "right")
+    optable.'newtok'("ternary:? :", 'looser' => 'infix:==', 'assoc' => 'right')
+    optable.'newtok'("infix:=", 'looser' => 'ternary:? :', 'assoc' => 'right')
 .end
 
 .sub "expr"

Reply via email to