Menu

Diff of /trunk/python/python.class [r4] .. [r5]  Maximize  Restore

Switch to side-by-side view

--- a/trunk/python/python.class
+++ b/trunk/python/python.class
@@ -1,239 +1,65 @@
-<?php 
+<?php
+
+
+/*
+
+DON'T EDIT THIS FILE!
+
+This file was automatically generated by the Lime parser generator.
+The real source code you should be looking at is in one or more
+grammar files in the Lime format.
+
+THE ONLY REASON TO LOOK AT THIS FILE is to see where in the grammar
+file that your error happened, because there are enough comments to
+help you debug your grammar.
+
+If you ignore this warning, you're shooting yourself in the brain,
+not the foot.
+
+*/
+
 class python extends lime_parser {
 var $qi = 0;
 var $i = array (
   0 => 
   array (
-    'exp' => 's 1',
-    'var' => 's 15',
-    'num' => 's 3',
-    '\'(\'' => 's 12',
-    'stmt' => 's 18',
+    'simple_stmt' => 's 1',
+    'compound_stmt' => 's 2',
+    'stmt' => 's 3',
     '\'start\'' => 'a \'start\'',
   ),
   1 => 
   array (
-    '\'!\'' => 's 2',
-    '\'-\'' => 's 6',
-    '\'*\'' => 's 8',
-    '\'/\'' => 's 10',
     '#' => 'r 0',
   ),
   2 => 
   array (
-    'num' => 's 3',
-    'var' => 's 4',
-    'exp' => 's 5',
-    '\'(\'' => 's 12',
+    '#' => 'r 1',
   ),
   3 => 
   array (
-    '\'!\'' => 'r 2',
-    '\'-\'' => 'r 2',
-    '\'*\'' => 'r 2',
-    '\'/\'' => 'r 2',
-    '\')\'' => 'r 2',
     '#' => 'r 2',
-  ),
-  4 => 
-  array (
-    '\'!\'' => 'r 3',
-    '\'-\'' => 'r 3',
-    '\'*\'' => 'r 3',
-    '\'/\'' => 'r 3',
-    '\')\'' => 'r 3',
-    '#' => 'r 3',
-  ),
-  5 => 
-  array (
-    '\'!\'' => 's 2',
-    '\'-\'' => 's 6',
-    '\'*\'' => 's 8',
-    '\'/\'' => 's 10',
-    '\')\'' => 'r 4',
-    '#' => 'r 4',
-  ),
-  6 => 
-  array (
-    'num' => 's 3',
-    'var' => 's 4',
-    'exp' => 's 7',
-    '\'(\'' => 's 12',
-  ),
-  7 => 
-  array (
-    '\'!\'' => 's 2',
-    '\'-\'' => 'r 5',
-    '\'*\'' => 's 8',
-    '\'/\'' => 's 10',
-    '\')\'' => 'r 5',
-    '#' => 'r 5',
-  ),
-  8 => 
-  array (
-    'num' => 's 3',
-    'var' => 's 4',
-    'exp' => 's 9',
-    '\'(\'' => 's 12',
-  ),
-  9 => 
-  array (
-    '\'!\'' => 's 2',
-    '\'-\'' => 'r 6',
-    '\'*\'' => 'r 6',
-    '\'/\'' => 'r 6',
-    '\')\'' => 'r 6',
-    '#' => 'r 6',
-  ),
-  10 => 
-  array (
-    'num' => 's 3',
-    'var' => 's 4',
-    'exp' => 's 11',
-    '\'(\'' => 's 12',
-  ),
-  11 => 
-  array (
-    '\'!\'' => 's 2',
-    '\'-\'' => 'r 7',
-    '\'*\'' => 'r 7',
-    '\'/\'' => 'r 7',
-    '\')\'' => 'r 7',
-    '#' => 'r 7',
-  ),
-  12 => 
-  array (
-    'num' => 's 3',
-    'var' => 's 4',
-    'exp' => 's 13',
-    '\'(\'' => 's 12',
-  ),
-  13 => 
-  array (
-    '\'!\'' => 's 2',
-    '\'-\'' => 's 6',
-    '\'*\'' => 's 8',
-    '\'/\'' => 's 10',
-    '\')\'' => 's 14',
-  ),
-  14 => 
-  array (
-    '\'/\'' => 'r 8',
-    '\'*\'' => 'r 8',
-    '\'-\'' => 'r 8',
-    '\'!\'' => 'r 8',
-    '\')\'' => 'r 8',
-    '#' => 'r 8',
-  ),
-  15 => 
-  array (
-    '\'=\'' => 's 16',
-    '\'!\'' => 'r 3',
-    '\'-\'' => 'r 3',
-    '\'*\'' => 'r 3',
-    '\'/\'' => 'r 3',
-    '#' => 'r 3',
-  ),
-  16 => 
-  array (
-    'exp' => 's 17',
-    'num' => 's 3',
-    'var' => 's 4',
-    '\'(\'' => 's 12',
-  ),
-  17 => 
-  array (
-    '\'!\'' => 's 2',
-    '\'-\'' => 's 6',
-    '\'*\'' => 's 8',
-    '\'/\'' => 's 10',
-    '#' => 'r 1',
-  ),
-  18 => 
-  array (
-    '#' => 'r 9',
   ),
 );
 function reduce_0_stmt_1($tokens, &$result) {
 #
-# (0) stmt :=  exp
-#
-$result = reset($tokens);
- echo " -> "; echo $tokens[0]; echo "\n"; 
-}
-
-function reduce_1_stmt_2($tokens, &$result) {
-#
-# (1) stmt :=  var  '='  exp
-#
-$result = reset($tokens);
-$v =& $tokens[0];
-$e =& $tokens[2];
-
-		echo "$v = $e\n";
-		set_variable($v, $e);
-  		
-}
-
-function reduce_2_exp_1($tokens, &$result) {
-#
-# (2) exp :=  num
+# (0) stmt :=  simple_stmt
 #
 $result = reset($tokens);
 
 }
 
-function reduce_3_exp_2($tokens, &$result) {
+function reduce_1_stmt_2($tokens, &$result) {
 #
-# (3) exp :=  var
+# (1) stmt :=  compound_stmt
 #
 $result = reset($tokens);
- $result = get_variable($tokens[0]); 
-}
-
-function reduce_4_exp_3($tokens, &$result) {
-#
-# (4) exp :=  exp  '!'  exp
-#
-$result = reset($tokens);
- $result = $tokens[0] + $tokens[2]; 
-}
-
-function reduce_5_exp_4($tokens, &$result) {
-#
-# (5) exp :=  exp  '-'  exp
-#
-$result = reset($tokens);
- $result = $tokens[0] - $tokens[2]; 
-}
-
-function reduce_6_exp_5($tokens, &$result) {
-#
-# (6) exp :=  exp  '*'  exp
-#
-$result = reset($tokens);
- $result = $tokens[0] * $tokens[2]; 
-}
-
-function reduce_7_exp_6($tokens, &$result) {
-#
-# (7) exp :=  exp  '/'  exp
-#
-$result = reset($tokens);
- $result = $tokens[0] / $tokens[2]; 
-}
-
-function reduce_8_exp_7($tokens, &$result) {
-#
-# (8) exp :=  '('  exp  ')'
-#
-$result = $tokens[1];
 
 }
 
-function reduce_9_start_1($tokens, &$result) {
+function reduce_2_start_1($tokens, &$result) {
 #
-# (9) 'start' :=  stmt
+# (2) 'start' :=  stmt
 #
 $result = reset($tokens);
 
@@ -242,14 +68,7 @@
 var $method = array (
   0 => 'reduce_0_stmt_1',
   1 => 'reduce_1_stmt_2',
-  2 => 'reduce_2_exp_1',
-  3 => 'reduce_3_exp_2',
-  4 => 'reduce_4_exp_3',
-  5 => 'reduce_5_exp_4',
-  6 => 'reduce_6_exp_5',
-  7 => 'reduce_7_exp_6',
-  8 => 'reduce_8_exp_7',
-  9 => 'reduce_9_start_1',
+  2 => 'reduce_2_start_1',
 );
 var $a = array (
   0 => 
@@ -261,52 +80,10 @@
   1 => 
   array (
     'symbol' => 'stmt',
-    'len' => 3,
+    'len' => 1,
     'replace' => true,
   ),
   2 => 
-  array (
-    'symbol' => 'exp',
-    'len' => 1,
-    'replace' => true,
-  ),
-  3 => 
-  array (
-    'symbol' => 'exp',
-    'len' => 1,
-    'replace' => true,
-  ),
-  4 => 
-  array (
-    'symbol' => 'exp',
-    'len' => 3,
-    'replace' => true,
-  ),
-  5 => 
-  array (
-    'symbol' => 'exp',
-    'len' => 3,
-    'replace' => true,
-  ),
-  6 => 
-  array (
-    'symbol' => 'exp',
-    'len' => 3,
-    'replace' => true,
-  ),
-  7 => 
-  array (
-    'symbol' => 'exp',
-    'len' => 3,
-    'replace' => true,
-  ),
-  8 => 
-  array (
-    'symbol' => 'exp',
-    'len' => 3,
-    'replace' => true,
-  ),
-  9 => 
   array (
     'symbol' => '\'start\'',
     'len' => 1,
@@ -314,5 +91,3 @@
   ),
 );
 }
-
-?>
\ No newline at end of file