Rename pyacc to piyacc, rename PYACC object and prefix to AST
authorNick Downing <downing.nick@gmail.com>
Tue, 11 Sep 2018 05:37:37 +0000 (15:37 +1000)
committerNick Downing <downing.nick@gmail.com>
Tue, 11 Sep 2018 05:37:37 +0000 (15:37 +1000)
ast.py
generate_bison.py
generate_py.py
piyacc.py [moved from bootstrap_pyacc.py with 78% similarity]
skel/skel_bison.c
skel/skel_bison.c.patch
skel/skel_bison.h
skel/skel_bison.h.patch
tests/Makefile

diff --git a/ast.py b/ast.py
index 770f444..23186af 100644 (file)
--- a/ast.py
+++ b/ast.py
@@ -32,7 +32,7 @@ class Item(element.Element):
   # GENERATE END
   def post_process(
     self,
-    pyacc,
+    _ast,
     section,
     character_to_symbol,
     name_to_symbol,
@@ -41,13 +41,13 @@ class Item(element.Element):
   ):
     raise NotImplementedError
  
-class PYACC(element.Element):
+class AST(element.Element):
   # internal classes
   class TagOrSymbol(element.Element):
     # GENERATE ELEMENT(str name, list(ref) code_props) BEGIN
     def __init__(
       self,
-      tag = 'PYACC_TagOrSymbol',
+      tag = 'AST_TagOrSymbol',
       attrib = {},
       text = '',
       children = [],
@@ -100,21 +100,21 @@ class PYACC(element.Element):
     def __repr__(self):
       params = []
       self.repr_serialize(params)
-      return 'ast.PYACC.TagOrSymbol({0:s})'.format(', '.join(params))
+      return 'ast.AST.TagOrSymbol({0:s})'.format(', '.join(params))
     # GENERATE END
 
   class Tag(TagOrSymbol):
     # GENERATE ELEMENT() BEGIN
     def __init__(
       self,
-      tag = 'PYACC_Tag',
+      tag = 'AST_Tag',
       attrib = {},
       text = '',
       children = [],
       name = '',
       code_props = []
     ):
-      PYACC.TagOrSymbol.__init__(
+      AST.TagOrSymbol.__init__(
         self,
         tag,
         attrib,
@@ -124,7 +124,7 @@ class PYACC(element.Element):
         code_props
       )
     def copy(self, factory = None):
-      result = PYACC.TagOrSymbol.copy(
+      result = AST.TagOrSymbol.copy(
         self,
         Tag if factory is None else factory
       )
@@ -132,7 +132,7 @@ class PYACC(element.Element):
     def __repr__(self):
       params = []
       self.repr_serialize(params)
-      return 'ast.PYACC.Tag({0:s})'.format(', '.join(params))
+      return 'ast.AST.Tag({0:s})'.format(', '.join(params))
     # GENERATE END
 
   class Symbol(TagOrSymbol):
@@ -142,7 +142,7 @@ class PYACC(element.Element):
     # GENERATE ELEMENT(int _type, int _tag, int precedence, list(int) character_set) BEGIN
     def __init__(
       self,
-      tag = 'PYACC_Symbol',
+      tag = 'AST_Symbol',
       attrib = {},
       text = '',
       children = [],
@@ -153,7 +153,7 @@ class PYACC(element.Element):
       precedence = -1,
       character_set = []
     ):
-      PYACC.TagOrSymbol.__init__(
+      AST.TagOrSymbol.__init__(
         self,
         tag,
         attrib,
@@ -183,7 +183,7 @@ class PYACC(element.Element):
         character_set
       )
     def serialize(self, ref_list):
-      PYACC.TagOrSymbol.serialize(self, ref_list)
+      AST.TagOrSymbol.serialize(self, ref_list)
       self.set('_type', element.serialize_int(self._type))
       self.set('_tag', element.serialize_int(self._tag))
       self.set('precedence', element.serialize_int(self.precedence))
@@ -192,7 +192,7 @@ class PYACC(element.Element):
         ' '.join([element.serialize_int(i) for i in self.character_set])
       )
     def deserialize(self, ref_list):
-      PYACC.TagOrSymbol.deserialize(self, ref_list)
+      AST.TagOrSymbol.deserialize(self, ref_list)
       self._type = element.deserialize_int(self.get('_type', '-1'))
       self._tag = element.deserialize_int(self.get('_tag', '-1'))
       self.precedence = element.deserialize_int(self.get('precedence', '-1'))
@@ -201,7 +201,7 @@ class PYACC(element.Element):
         for i in self.get('character_set', '').split()
       ]
     def copy(self, factory = None):
-      result = PYACC.TagOrSymbol.copy(
+      result = AST.TagOrSymbol.copy(
         self,
         Symbol if factory is None else factory
       )
@@ -211,7 +211,7 @@ class PYACC(element.Element):
       result.character_set = self.character_set
       return result
     def repr_serialize(self, params):
-      PYACC.TagOrSymbol.repr_serialize(self, params)
+      AST.TagOrSymbol.repr_serialize(self, params)
       if self._type != -1:
         params.append(
           '_type = {0:s}'.format(repr(self._type))
@@ -233,7 +233,7 @@ class PYACC(element.Element):
     def __repr__(self):
       params = []
       self.repr_serialize(params)
-      return 'ast.PYACC.Symbol({0:s})'.format(', '.join(params))
+      return 'ast.AST.Symbol({0:s})'.format(', '.join(params))
     # GENERATE END
 
   # syntax classes
@@ -241,7 +241,7 @@ class PYACC(element.Element):
     # GENERATE ELEMENT() BEGIN
     def __init__(
       self,
-      tag = 'PYACC_BracedPredicate',
+      tag = 'AST_BracedPredicate',
       attrib = {},
       text = '',
       children = []
@@ -262,14 +262,14 @@ class PYACC(element.Element):
     def __repr__(self):
       params = []
       self.repr_serialize(params)
-      return 'ast.PYACC.BracedPredicate({0:s})'.format(', '.join(params))
+      return 'ast.AST.BracedPredicate({0:s})'.format(', '.join(params))
     # GENERATE END
 
   class Char(element.Element):
     # GENERATE ELEMENT() BEGIN
     def __init__(
       self,
-      tag = 'PYACC_Char',
+      tag = 'AST_Char',
       attrib = {},
       text = '',
       children = []
@@ -290,14 +290,14 @@ class PYACC(element.Element):
     def __repr__(self):
       params = []
       self.repr_serialize(params)
-      return 'ast.PYACC.Char({0:s})'.format(', '.join(params))
+      return 'ast.AST.Char({0:s})'.format(', '.join(params))
     # GENERATE END
 
   class Int(element.Element):
     # GENERATE ELEMENT() BEGIN
     def __init__(
       self,
-      tag = 'PYACC_Int',
+      tag = 'AST_Int',
       attrib = {},
       text = '',
       children = []
@@ -318,7 +318,7 @@ class PYACC(element.Element):
     def __repr__(self):
       params = []
       self.repr_serialize(params)
-      return 'ast.PYACC.Int({0:s})'.format(', '.join(params))
+      return 'ast.AST.Int({0:s})'.format(', '.join(params))
     # GENERATE END
 
   class Production(element.Element):
@@ -326,7 +326,7 @@ class PYACC(element.Element):
       # GENERATE ELEMENT() BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Production_Item',
+        tag = 'AST_Production_Item',
         attrib = {},
         text = '',
         children = []
@@ -347,11 +347,11 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Production.Item({0:s})'.format(', '.join(params))
+        return 'ast.AST.Production.Item({0:s})'.format(', '.join(params))
       # GENERATE END
       def post_process(
         self,
-        pyacc,
+        _ast,
         section,
         production,
         character_to_symbol,
@@ -363,7 +363,7 @@ class PYACC(element.Element):
         raise NotImplementedError
       def add_to_symbols(
         self,
-        pyacc,
+        _ast,
         production,
         last_action,
         _lr1,
@@ -376,12 +376,12 @@ class PYACC(element.Element):
       # GENERATE ELEMENT() BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Production_Action',
+        tag = 'AST_Production_Action',
         attrib = {},
         text = '',
         children = []
       ):
-        PYACC.Production.Item.__init__(
+        AST.Production.Item.__init__(
           self,
           tag,
           attrib,
@@ -389,7 +389,7 @@ class PYACC(element.Element):
           children
         )
       def copy(self, factory = None):
-        result = PYACC.Production.Item.copy(
+        result = AST.Production.Item.copy(
           self,
           Action if factory is None else factory
         )
@@ -397,11 +397,11 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Production.Action({0:s})'.format(', '.join(params))
+        return 'ast.AST.Production.Action({0:s})'.format(', '.join(params))
       # GENERATE END
       def post_process(
         self,
-        pyacc,
+        _ast,
         section,
         production,
         character_to_symbol,
@@ -410,12 +410,12 @@ class PYACC(element.Element):
         name_to_tag,
         last_action
       ):
-        pyacc.n_productions += int(last_action) # midrule action production
+        _ast.n_productions += int(last_action) # midrule action production
         production.n_symbols += int(last_action) # midrule action symbol
         return True
       def add_to_symbols(
         self,
-        pyacc,
+        _ast,
         production,
         last_action,
         _lr1,
@@ -437,11 +437,11 @@ class PYACC(element.Element):
               last_action
             )
           )
-        assert isinstance(self[0], PYACC.Text) # temporary
+        assert isinstance(self[0], AST.Text) # temporary
         for i in self[0]:
-          if isinstance(i, PYACC.Text.StackLocation):
+          if isinstance(i, AST.Text.StackLocation):
             i.offset = -len(symbols)
-          elif isinstance(i, PYACC.Text.StackReference):
+          elif isinstance(i, AST.Text.StackReference):
             if (
               len(i.tag_name) == 0 and
               i.index >= 1 and
@@ -455,13 +455,13 @@ class PYACC(element.Element):
       # GENERATE ELEMENT(int value) BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Production_DPrec',
+        tag = 'AST_Production_DPrec',
         attrib = {},
         text = '',
         children = [],
         value = -1
       ):
-        PYACC.Production.Item.__init__(
+        AST.Production.Item.__init__(
           self,
           tag,
           attrib,
@@ -474,20 +474,20 @@ class PYACC(element.Element):
           value
         )
       def serialize(self, ref_list):
-        PYACC.Production.Item.serialize(self, ref_list)
+        AST.Production.Item.serialize(self, ref_list)
         self.set('value', element.serialize_int(self.value))
       def deserialize(self, ref_list):
-        PYACC.Production.Item.deserialize(self, ref_list)
+        AST.Production.Item.deserialize(self, ref_list)
         self.value = element.deserialize_int(self.get('value', '-1'))
       def copy(self, factory = None):
-        result = PYACC.Production.Item.copy(
+        result = AST.Production.Item.copy(
           self,
           DPrec if factory is None else factory
         )
         result.value = self.value
         return result
       def repr_serialize(self, params):
-        PYACC.Production.Item.repr_serialize(self, params)
+        AST.Production.Item.repr_serialize(self, params)
         if self.value != -1:
           params.append(
             'value = {0:s}'.format(repr(self.value))
@@ -495,19 +495,19 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Production.DPrec({0:s})'.format(', '.join(params))
+        return 'ast.AST.Production.DPrec({0:s})'.format(', '.join(params))
       # GENERATE END
 
     class Empty(Item):
       # GENERATE ELEMENT() BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Production_Empty',
+        tag = 'AST_Production_Empty',
         attrib = {},
         text = '',
         children = []
       ):
-        PYACC.Production.Item.__init__(
+        AST.Production.Item.__init__(
           self,
           tag,
           attrib,
@@ -515,7 +515,7 @@ class PYACC(element.Element):
           children
         )
       def copy(self, factory = None):
-        result = PYACC.Production.Item.copy(
+        result = AST.Production.Item.copy(
           self,
           Empty if factory is None else factory
         )
@@ -523,11 +523,11 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Production.Empty({0:s})'.format(', '.join(params))
+        return 'ast.AST.Production.Empty({0:s})'.format(', '.join(params))
       # GENERATE END
       def post_process(
         self,
-        pyacc,
+        _ast,
         section,
         production,
         character_to_symbol,
@@ -541,7 +541,7 @@ class PYACC(element.Element):
 
       def add_to_symbols(
         self,
-        pyacc,
+        _ast,
         production,
         last_action,
         _lr1,
@@ -555,12 +555,12 @@ class PYACC(element.Element):
       # GENERATE ELEMENT() BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Production_Merge',
+        tag = 'AST_Production_Merge',
         attrib = {},
         text = '',
         children = []
       ):
-        PYACC.Production.Item.__init__(
+        AST.Production.Item.__init__(
           self,
           tag,
           attrib,
@@ -568,7 +568,7 @@ class PYACC(element.Element):
           children
         )
       def copy(self, factory = None):
-        result = PYACC.Production.Item.copy(
+        result = AST.Production.Item.copy(
           self,
           Merge if factory is None else factory
         )
@@ -576,20 +576,20 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Production.Merge({0:s})'.format(', '.join(params))
+        return 'ast.AST.Production.Merge({0:s})'.format(', '.join(params))
       # GENERATE END
 
     class Prec(Item):
       # GENERATE ELEMENT(int symbol) BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Production_Prec',
+        tag = 'AST_Production_Prec',
         attrib = {},
         text = '',
         children = [],
         symbol = -1
       ):
-        PYACC.Production.Item.__init__(
+        AST.Production.Item.__init__(
           self,
           tag,
           attrib,
@@ -602,20 +602,20 @@ class PYACC(element.Element):
           symbol
         )
       def serialize(self, ref_list):
-        PYACC.Production.Item.serialize(self, ref_list)
+        AST.Production.Item.serialize(self, ref_list)
         self.set('symbol', element.serialize_int(self.symbol))
       def deserialize(self, ref_list):
-        PYACC.Production.Item.deserialize(self, ref_list)
+        AST.Production.Item.deserialize(self, ref_list)
         self.symbol = element.deserialize_int(self.get('symbol', '-1'))
       def copy(self, factory = None):
-        result = PYACC.Production.Item.copy(
+        result = AST.Production.Item.copy(
           self,
           Prec if factory is None else factory
         )
         result.symbol = self.symbol
         return result
       def repr_serialize(self, params):
-        PYACC.Production.Item.repr_serialize(self, params)
+        AST.Production.Item.repr_serialize(self, params)
         if self.symbol != -1:
           params.append(
             'symbol = {0:s}'.format(repr(self.symbol))
@@ -623,11 +623,11 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Production.Prec({0:s})'.format(', '.join(params))
+        return 'ast.AST.Production.Prec({0:s})'.format(', '.join(params))
       # GENERATE END
       def post_process(
         self,
-        pyacc,
+        _ast,
         section,
         production,
         character_to_symbol,
@@ -638,13 +638,13 @@ class PYACC(element.Element):
       ):
         assert production.precedence_terminal == -1
         _, production.precedence_terminal = self[0].post_process(
-          pyacc,
+          _ast,
           section,
           character_to_symbol,
           name_to_symbol,
           string_to_symbol,
           name_to_tag,
-          PYACC.Symbol.TYPE_TERMINAL, # _type
+          AST.Symbol.TYPE_TERMINAL, # _type
           -1, # _tag
           -1 # precedence
         )
@@ -654,13 +654,13 @@ class PYACC(element.Element):
       # GENERATE ELEMENT(int symbol) BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Production_SymbolRef',
+        tag = 'AST_Production_SymbolRef',
         attrib = {},
         text = '',
         children = [],
         symbol = -1
       ):
-        PYACC.Production.Item.__init__(
+        AST.Production.Item.__init__(
           self,
           tag,
           attrib,
@@ -673,20 +673,20 @@ class PYACC(element.Element):
           symbol
         )
       def serialize(self, ref_list):
-        PYACC.Production.Item.serialize(self, ref_list)
+        AST.Production.Item.serialize(self, ref_list)
         self.set('symbol', element.serialize_int(self.symbol))
       def deserialize(self, ref_list):
-        PYACC.Production.Item.deserialize(self, ref_list)
+        AST.Production.Item.deserialize(self, ref_list)
         self.symbol = element.deserialize_int(self.get('symbol', '-1'))
       def copy(self, factory = None):
-        result = PYACC.Production.Item.copy(
+        result = AST.Production.Item.copy(
           self,
           SymbolRef if factory is None else factory
         )
         result.symbol = self.symbol
         return result
       def repr_serialize(self, params):
-        PYACC.Production.Item.repr_serialize(self, params)
+        AST.Production.Item.repr_serialize(self, params)
         if self.symbol != -1:
           params.append(
             'symbol = {0:s}'.format(repr(self.symbol))
@@ -694,11 +694,11 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Production.SymbolRef({0:s})'.format(', '.join(params))
+        return 'ast.AST.Production.SymbolRef({0:s})'.format(', '.join(params))
       # GENERATE END
       def post_process(
         self,
-        pyacc,
+        _ast,
         section,
         production,
         character_to_symbol,
@@ -707,10 +707,10 @@ class PYACC(element.Element):
         name_to_tag,
         last_action
       ):
-        pyacc.n_productions += int(last_action) # midrule action production
+        _ast.n_productions += int(last_action) # midrule action production
         production.n_symbols += int(last_action) + 1 # midrule action symbol
         _, self.symbol = self[0].post_process(
-          pyacc,
+          _ast,
           section,
           character_to_symbol,
           name_to_symbol,
@@ -720,12 +720,12 @@ class PYACC(element.Element):
           -1, # _tag
           -1 # precedence
         )
-        if pyacc.symbols[self.symbol]._type == PYACC.Symbol.TYPE_TERMINAL:
+        if _ast.symbols[self.symbol]._type == AST.Symbol.TYPE_TERMINAL:
           production.last_terminal = self.symbol
         return False
       def add_to_symbols(
         self,
-        pyacc,
+        _ast,
         production,
         last_action,
         _lr1,
@@ -748,21 +748,21 @@ class PYACC(element.Element):
             )
           )
         symbols.append(
-          (pyacc.symbols[self.symbol].character_set, [])
-        if pyacc.symbols[self.symbol]._type == PYACC.Symbol.TYPE_TERMINAL else
-          ([], pyacc.symbols[self.symbol].character_set)
+          (_ast.symbols[self.symbol].character_set, [])
+        if _ast.symbols[self.symbol]._type == AST.Symbol.TYPE_TERMINAL else
+          ([], _ast.symbols[self.symbol].character_set)
         )
         tag_names.append(
           ''
-        if pyacc.symbols[self.symbol]._tag == -1 else
-          pyacc.tags[pyacc.symbols[self.symbol]._tag].name
+        if _ast.symbols[self.symbol]._tag == -1 else
+          _ast.tags[_ast.symbols[self.symbol]._tag].name
         )
         return None
 
     # GENERATE ELEMENT(int lhs_nonterminal, int n_symbols, int last_terminal, int precedence_terminal) BEGIN
     def __init__(
       self,
-      tag = 'PYACC_Production',
+      tag = 'AST_Production',
       attrib = {},
       text = '',
       children = [],
@@ -841,12 +841,12 @@ class PYACC(element.Element):
     def __repr__(self):
       params = []
       self.repr_serialize(params)
-      return 'ast.PYACC.Production({0:s})'.format(', '.join(params))
+      return 'ast.AST.Production({0:s})'.format(', '.join(params))
     # GENERATE END
 
     def post_process(
       self,
-      pyacc,
+      _ast,
       section,
       lhs_nonterminal,
       character_to_symbol,
@@ -862,7 +862,7 @@ class PYACC(element.Element):
       last_action = False
       for i in self:
         last_action = i.post_process(
-          pyacc,
+          _ast,
           section,
           self,
           character_to_symbol,
@@ -872,21 +872,21 @@ class PYACC(element.Element):
           last_action
         )
 
-      i = pyacc.symbols[self.lhs_nonterminal]
-      if len(i.character_set) and i.character_set[-1] == pyacc.n_productions:
-        i.character_set[-1] = pyacc.n_productions + 1
+      i = _ast.symbols[self.lhs_nonterminal]
+      if len(i.character_set) and i.character_set[-1] == _ast.n_productions:
+        i.character_set[-1] = _ast.n_productions + 1
       else:
-        i.character_set.extend([pyacc.n_productions, pyacc.n_productions + 1])
-      pyacc.n_productions += 1
-      pyacc.productions.append(self)
+        i.character_set.extend([_ast.n_productions, _ast.n_productions + 1])
+      _ast.n_productions += 1
+      _ast.productions.append(self)
 
-    def add_to_lr1(self, pyacc, _lr1):
+    def add_to_lr1(self, _ast, _lr1):
       last_action = None
       symbols = []
       tag_names = []
       for i in self:
         last_action = i.add_to_symbols(
-          pyacc,
+          _ast,
           self,
           last_action,
           _lr1,
@@ -898,13 +898,13 @@ class PYACC(element.Element):
       if last_action is not None:
         for i in last_action:
           if (
-            isinstance(i, PYACC.Text.ValueReference) and
+            isinstance(i, AST.Text.ValueReference) and
             len(i.tag_name) == 0
           ):
             i.tag_name = (
               ''
-            if pyacc.symbols[self.lhs_nonterminal]._tag == -1 else
-              pyacc.tags[pyacc.symbols[self.lhs_nonterminal]._tag].name
+            if _ast.symbols[self.lhs_nonterminal]._tag == -1 else
+              _ast.tags[_ast.symbols[self.lhs_nonterminal]._tag].name
             )
 
       _lr1.productions.append(
@@ -919,9 +919,9 @@ class PYACC(element.Element):
       )
 
       precedence = (
-        pyacc.symbols[self.precedence_terminal].precedence
+        _ast.symbols[self.precedence_terminal].precedence
       if self.precedence_terminal != -1 else
-        pyacc.symbols[self.last_terminal].precedence
+        _ast.symbols[self.last_terminal].precedence
       if self.last_terminal != -1 else
         -1
       )
@@ -936,7 +936,7 @@ class PYACC(element.Element):
       # GENERATE ELEMENT() BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Section1Or2_Code',
+        tag = 'AST_Section1Or2_Code',
         attrib = {},
         text = '',
         children = []
@@ -957,11 +957,11 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Section1Or2.Code({0:s})'.format(', '.join(params))
+        return 'ast.AST.Section1Or2.Code({0:s})'.format(', '.join(params))
       # GENERATE END
       def post_process(
         self,
-        pyacc,
+        _ast,
         section,
         character_to_symbol,
         name_to_symbol,
@@ -971,14 +971,14 @@ class PYACC(element.Element):
         name = self[0].get_text()
         if len(name) == 0: # do the same as Section1.Prologue
           (
-            pyacc.before_union_text
-          if len(pyacc.union_text) == 0 else
-            pyacc.after_union_text
+            _ast.before_union_text
+          if len(_ast.union_text) == 0 else
+            _ast.after_union_text
           ).append(self[1][0])
         elif name == 'top':
-          pyacc.top_text.append(self[1][0])
+          _ast.top_text.append(self[1][0])
         elif name == 'requires':
-          pyacc.requires_text.append(self[1][0])
+          _ast.requires_text.append(self[1][0])
         else:
           assert False
  
@@ -986,7 +986,7 @@ class PYACC(element.Element):
       # GENERATE ELEMENT(int _type) BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Section1Or2_CodeProps',
+        tag = 'AST_Section1Or2_CodeProps',
         attrib = {},
         text = '',
         children = [],
@@ -1026,11 +1026,11 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Section1Or2.CodeProps({0:s})'.format(', '.join(params))
+        return 'ast.AST.Section1Or2.CodeProps({0:s})'.format(', '.join(params))
       # GENERATE END
       def post_process(
         self,
-        pyacc,
+        _ast,
         section,
         character_to_symbol,
         name_to_symbol,
@@ -1039,7 +1039,7 @@ class PYACC(element.Element):
       ):
         for i in self[1:]:
           _, j = i.post_process(
-            pyacc,
+            _ast,
             section,
             character_to_symbol,
             name_to_symbol,
@@ -1049,7 +1049,7 @@ class PYACC(element.Element):
             -1, # _tag
             -1 # precedence
           )
-          tag_or_symbol = pyacc.symbols[j] if j >= 0 else pyacc.tags[~j]
+          tag_or_symbol = _ast.symbols[j] if j >= 0 else _ast.tags[~j]
           assert tag_or_symbol.code_props[self._type] is None
           tag_or_symbol.code_props[self._type] = self[0]
 
@@ -1057,7 +1057,7 @@ class PYACC(element.Element):
       # GENERATE ELEMENT() BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Section1Or2_DefaultPrec',
+        tag = 'AST_Section1Or2_DefaultPrec',
         attrib = {},
         text = '',
         children = []
@@ -1078,14 +1078,14 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Section1Or2.DefaultPrec({0:s})'.format(', '.join(params))
+        return 'ast.AST.Section1Or2.DefaultPrec({0:s})'.format(', '.join(params))
       # GENERATE END
 
     class NTerm(Item):
       # GENERATE ELEMENT() BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Section1Or2_NTerm',
+        tag = 'AST_Section1Or2_NTerm',
         attrib = {},
         text = '',
         children = []
@@ -1106,11 +1106,11 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Section1Or2.NTerm({0:s})'.format(', '.join(params))
+        return 'ast.AST.Section1Or2.NTerm({0:s})'.format(', '.join(params))
       # GENERATE END
       def post_process(
         self,
-        pyacc,
+        _ast,
         section,
         character_to_symbol,
         name_to_symbol,
@@ -1120,13 +1120,13 @@ class PYACC(element.Element):
         _tag = -1
         for i in self:
           _tag, _ = i.post_process(
-            pyacc,
+            _ast,
             section,
             character_to_symbol,
             name_to_symbol,
             string_to_symbol,
             name_to_tag,
-            PYACC.Symbol.TYPE_NONTERMINAL, # _type
+            AST.Symbol.TYPE_NONTERMINAL, # _type
             _tag,
             -1 # precedence
           )
@@ -1135,7 +1135,7 @@ class PYACC(element.Element):
       # GENERATE ELEMENT(int _type) BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Section1Or2_Precedence',
+        tag = 'AST_Section1Or2_Precedence',
         attrib = {},
         text = '',
         children = [],
@@ -1175,11 +1175,11 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Section1Or2.Precedence({0:s})'.format(', '.join(params))
+        return 'ast.AST.Section1Or2.Precedence({0:s})'.format(', '.join(params))
       # GENERATE END
       def post_process(
         self,
-        pyacc,
+        _ast,
         section,
         character_to_symbol,
         name_to_symbol,
@@ -1189,23 +1189,23 @@ class PYACC(element.Element):
         _tag = -1
         for i in self:
           _tag, _ = i.post_process(
-            pyacc,
+            _ast,
             section,
             character_to_symbol,
             name_to_symbol,
             string_to_symbol,
             name_to_tag,
-            PYACC.Symbol.TYPE_TERMINAL, # _type
+            AST.Symbol.TYPE_TERMINAL, # _type
             _tag,
-            len(pyacc.associativities) # precedence
+            len(_ast.associativities) # precedence
           )
-        pyacc.associativities.append(self._type)
+        _ast.associativities.append(self._type)
 
     class Start(Item):
       # GENERATE ELEMENT() BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Section1Or2_Start',
+        tag = 'AST_Section1Or2_Start',
         attrib = {},
         text = '',
         children = []
@@ -1226,25 +1226,25 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Section1Or2.Start({0:s})'.format(', '.join(params))
+        return 'ast.AST.Section1Or2.Start({0:s})'.format(', '.join(params))
       # GENERATE END
       def post_process(
         self,
-        pyacc,
+        _ast,
         section,
         character_to_symbol,
         name_to_symbol,
         string_to_symbol,
         name_to_tag
       ):
-        _, pyacc.start_nonterminal = self[0].post_process(
-          pyacc,
+        _, _ast.start_nonterminal = self[0].post_process(
+          _ast,
           section,
           character_to_symbol,
           name_to_symbol,
           string_to_symbol,
           name_to_tag,
-          PYACC.Symbol.TYPE_NONTERMINAL, # _type
+          AST.Symbol.TYPE_NONTERMINAL, # _type
           -1, # _tag
           -1 # precedence
         )
@@ -1253,7 +1253,7 @@ class PYACC(element.Element):
       # GENERATE ELEMENT() BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Section1Or2_Token',
+        tag = 'AST_Section1Or2_Token',
         attrib = {},
         text = '',
         children = []
@@ -1274,11 +1274,11 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Section1Or2.Token({0:s})'.format(', '.join(params))
+        return 'ast.AST.Section1Or2.Token({0:s})'.format(', '.join(params))
       # GENERATE END
       def post_process(
         self,
-        pyacc,
+        _ast,
         section,
         character_to_symbol,
         name_to_symbol,
@@ -1288,13 +1288,13 @@ class PYACC(element.Element):
         _tag = -1
         for i in self:
           _tag, _ = i.post_process(
-            pyacc,
+            _ast,
             section,
             character_to_symbol,
             name_to_symbol,
             string_to_symbol,
             name_to_tag,
-            PYACC.Symbol.TYPE_TERMINAL, # _type
+            AST.Symbol.TYPE_TERMINAL, # _type
             _tag,
             -1 # precedence
           )
@@ -1303,7 +1303,7 @@ class PYACC(element.Element):
       # GENERATE ELEMENT() BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Section1Or2_Type',
+        tag = 'AST_Section1Or2_Type',
         attrib = {},
         text = '',
         children = []
@@ -1324,11 +1324,11 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Section1Or2.Type({0:s})'.format(', '.join(params))
+        return 'ast.AST.Section1Or2.Type({0:s})'.format(', '.join(params))
       # GENERATE END
       def post_process(
         self,
-        pyacc,
+        _ast,
         section,
         character_to_symbol,
         name_to_symbol,
@@ -1338,7 +1338,7 @@ class PYACC(element.Element):
         _tag = -1
         for i in self:
           _tag, _ = i.post_process(
-            pyacc,
+            _ast,
             section,
             character_to_symbol,
             name_to_symbol,
@@ -1353,7 +1353,7 @@ class PYACC(element.Element):
       # GENERATE ELEMENT() BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Section1Or2_Union',
+        tag = 'AST_Section1Or2_Union',
         attrib = {},
         text = '',
         children = []
@@ -1374,11 +1374,11 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Section1Or2.Union({0:s})'.format(', '.join(params))
+        return 'ast.AST.Section1Or2.Union({0:s})'.format(', '.join(params))
       # GENERATE END
       def post_process(
         self,
-        pyacc,
+        _ast,
         section,
         character_to_symbol,
         name_to_symbol,
@@ -1387,14 +1387,14 @@ class PYACC(element.Element):
       ):
         name = self[0].get_text()
         if len(name):
-          assert len(pyacc.union_name) == 0
-          pyacc.union_name = name
-        pyacc.union_text.append(self[1][0])
+          assert len(_ast.union_name) == 0
+          _ast.union_name = name
+        _ast.union_text.append(self[1][0])
 
     # GENERATE ELEMENT() BEGIN
     def __init__(
       self,
-      tag = 'PYACC_Section1Or2',
+      tag = 'AST_Section1Or2',
       attrib = {},
       text = '',
       children = []
@@ -1415,11 +1415,11 @@ class PYACC(element.Element):
     def __repr__(self):
       params = []
       self.repr_serialize(params)
-      return 'ast.PYACC.Section1Or2({0:s})'.format(', '.join(params))
+      return 'ast.AST.Section1Or2({0:s})'.format(', '.join(params))
     # GENERATE END
     def post_process(
       self,
-      pyacc,
+      _ast,
       character_to_symbol,
       name_to_symbol,
       string_to_symbol,
@@ -1427,7 +1427,7 @@ class PYACC(element.Element):
     ):
       for i in self:
         i.post_process(
-          pyacc,
+          _ast,
           self,
           character_to_symbol,
           name_to_symbol,
@@ -1440,7 +1440,7 @@ class PYACC(element.Element):
       # GENERATE ELEMENT() BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Section1_Debug',
+        tag = 'AST_Section1_Debug',
         attrib = {},
         text = '',
         children = []
@@ -1461,11 +1461,11 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Section1.Debug({0:s})'.format(', '.join(params))
+        return 'ast.AST.Section1.Debug({0:s})'.format(', '.join(params))
       # GENERATE END
       def post_process(
         self,
-        pyacc,
+        _ast,
         section,
         character_to_symbol,
         name_to_symbol,
@@ -1478,7 +1478,7 @@ class PYACC(element.Element):
       # GENERATE ELEMENT() BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Section1_Define',
+        tag = 'AST_Section1_Define',
         attrib = {},
         text = '',
         children = []
@@ -1499,11 +1499,11 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Section1.Define({0:s})'.format(', '.join(params))
+        return 'ast.AST.Section1.Define({0:s})'.format(', '.join(params))
       # GENERATE END
       def post_process(
         self,
-        pyacc,
+        _ast,
         section,
         character_to_symbol,
         name_to_symbol,
@@ -1516,7 +1516,7 @@ class PYACC(element.Element):
         if len(self) < 2 else
           (
             self[1]
-          if isinstance(self[1], PYACC.ID) else
+          if isinstance(self[1], AST.ID) else
             self[1][0] # String or BracedCode
           ).get_text()
         )
@@ -1562,7 +1562,7 @@ class PYACC(element.Element):
       # GENERATE ELEMENT() BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Section1_Defines',
+        tag = 'AST_Section1_Defines',
         attrib = {},
         text = '',
         children = []
@@ -1583,11 +1583,11 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Section1.Defines({0:s})'.format(', '.join(params))
+        return 'ast.AST.Section1.Defines({0:s})'.format(', '.join(params))
       # GENERATE END
       def post_process(
         self,
-        pyacc,
+        _ast,
         section,
         character_to_symbol,
         name_to_symbol,
@@ -1601,7 +1601,7 @@ class PYACC(element.Element):
       # GENERATE ELEMENT() BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Section1_ErrorVerbose',
+        tag = 'AST_Section1_ErrorVerbose',
         attrib = {},
         text = '',
         children = []
@@ -1622,11 +1622,11 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Section1.ErrorVerbose({0:s})'.format(', '.join(params))
+        return 'ast.AST.Section1.ErrorVerbose({0:s})'.format(', '.join(params))
       # GENERATE END
       def post_process(
         self,
-        pyacc,
+        _ast,
         section,
         character_to_symbol,
         name_to_symbol,
@@ -1639,7 +1639,7 @@ class PYACC(element.Element):
       # GENERATE ELEMENT(int value) BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Section1_Expect',
+        tag = 'AST_Section1_Expect',
         attrib = {},
         text = '',
         children = [],
@@ -1679,11 +1679,11 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Section1.Expect({0:s})'.format(', '.join(params))
+        return 'ast.AST.Section1.Expect({0:s})'.format(', '.join(params))
       # GENERATE END
       def post_process(
         self,
-        pyacc,
+        _ast,
         section,
         character_to_symbol,
         name_to_symbol,
@@ -1696,7 +1696,7 @@ class PYACC(element.Element):
       # GENERATE ELEMENT(int value) BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Section1_ExpectRR',
+        tag = 'AST_Section1_ExpectRR',
         attrib = {},
         text = '',
         children = [],
@@ -1736,14 +1736,14 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Section1.ExpectRR({0:s})'.format(', '.join(params))
+        return 'ast.AST.Section1.ExpectRR({0:s})'.format(', '.join(params))
       # GENERATE END
 
     class FilePrefix(Item):
       # GENERATE ELEMENT() BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Section1_FilePrefix',
+        tag = 'AST_Section1_FilePrefix',
         attrib = {},
         text = '',
         children = []
@@ -1764,14 +1764,14 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Section1.FilePrefix({0:s})'.format(', '.join(params))
+        return 'ast.AST.Section1.FilePrefix({0:s})'.format(', '.join(params))
       # GENERATE END
 
     class GLRParser(Item):
       # GENERATE ELEMENT() BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Section1_GLRParser',
+        tag = 'AST_Section1_GLRParser',
         attrib = {},
         text = '',
         children = []
@@ -1792,14 +1792,14 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Section1.GLRParser({0:s})'.format(', '.join(params))
+        return 'ast.AST.Section1.GLRParser({0:s})'.format(', '.join(params))
       # GENERATE END
 
     class InitialAction(Item):
       # GENERATE ELEMENT() BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Section1_InitialAction',
+        tag = 'AST_Section1_InitialAction',
         attrib = {},
         text = '',
         children = []
@@ -1820,25 +1820,25 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Section1.InitialAction({0:s})'.format(', '.join(params))
+        return 'ast.AST.Section1.InitialAction({0:s})'.format(', '.join(params))
       # GENERATE END
       def post_process(
         self,
-        pyacc,
+        _ast,
         section,
         character_to_symbol,
         name_to_symbol,
         string_to_symbol,
         name_to_tag
       ):
-        assert isinstance(self[0], PYACC.Text) # temporary
-        pyacc.initial_action_text.append(self[0])
+        assert isinstance(self[0], AST.Text) # temporary
+        _ast.initial_action_text.append(self[0])
 
     class Language(Item):
       # GENERATE ELEMENT() BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Section1_Language',
+        tag = 'AST_Section1_Language',
         attrib = {},
         text = '',
         children = []
@@ -1859,14 +1859,14 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Section1.Language({0:s})'.format(', '.join(params))
+        return 'ast.AST.Section1.Language({0:s})'.format(', '.join(params))
       # GENERATE END
 
     class Lines(Item):
       # GENERATE ELEMENT() BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Section1_Lines',
+        tag = 'AST_Section1_Lines',
         attrib = {},
         text = '',
         children = []
@@ -1887,14 +1887,14 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Section1.Lines({0:s})'.format(', '.join(params))
+        return 'ast.AST.Section1.Lines({0:s})'.format(', '.join(params))
       # GENERATE END
 
     class Locations(Item):
       # GENERATE ELEMENT() BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Section1_Locations',
+        tag = 'AST_Section1_Locations',
         attrib = {},
         text = '',
         children = []
@@ -1915,11 +1915,11 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Section1.Locations({0:s})'.format(', '.join(params))
+        return 'ast.AST.Section1.Locations({0:s})'.format(', '.join(params))
       # GENERATE END
       def post_process(
         self,
-        pyacc,
+        _ast,
         section,
         character_to_symbol,
         name_to_symbol,
@@ -1932,7 +1932,7 @@ class PYACC(element.Element):
       # GENERATE ELEMENT() BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Section1_NamePrefix',
+        tag = 'AST_Section1_NamePrefix',
         attrib = {},
         text = '',
         children = []
@@ -1953,11 +1953,11 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Section1.NamePrefix({0:s})'.format(', '.join(params))
+        return 'ast.AST.Section1.NamePrefix({0:s})'.format(', '.join(params))
       # GENERATE END
       def post_process(
         self,
-        pyacc,
+        _ast,
         section,
         character_to_symbol,
         name_to_symbol,
@@ -1970,7 +1970,7 @@ class PYACC(element.Element):
       # GENERATE ELEMENT() BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Section1_NonDeterministicParser',
+        tag = 'AST_Section1_NonDeterministicParser',
         attrib = {},
         text = '',
         children = []
@@ -1991,14 +1991,14 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Section1.NonDeterministicParser({0:s})'.format(', '.join(params))
+        return 'ast.AST.Section1.NonDeterministicParser({0:s})'.format(', '.join(params))
       # GENERATE END
 
     class Output(Item):
       # GENERATE ELEMENT() BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Section1_Output',
+        tag = 'AST_Section1_Output',
         attrib = {},
         text = '',
         children = []
@@ -2019,14 +2019,14 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Section1.Output({0:s})'.format(', '.join(params))
+        return 'ast.AST.Section1.Output({0:s})'.format(', '.join(params))
       # GENERATE END
 
     class Param(Item):
       # GENERATE ELEMENT() BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Section1_Param',
+        tag = 'AST_Section1_Param',
         attrib = {},
         text = '',
         children = []
@@ -2047,14 +2047,14 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Section1.Param({0:s})'.format(', '.join(params))
+        return 'ast.AST.Section1.Param({0:s})'.format(', '.join(params))
       # GENERATE END
 
     class Prologue(Item):
       # GENERATE ELEMENT() BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Section1_Prologue',
+        tag = 'AST_Section1_Prologue',
         attrib = {},
         text = '',
         children = []
@@ -2075,11 +2075,11 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Section1.Prologue({0:s})'.format(', '.join(params))
+        return 'ast.AST.Section1.Prologue({0:s})'.format(', '.join(params))
       # GENERATE END
       def post_process(
         self,
-        pyacc,
+        _ast,
         section,
         character_to_symbol,
         name_to_symbol,
@@ -2087,16 +2087,16 @@ class PYACC(element.Element):
         name_to_tag
       ):
         (
-          pyacc.before_union_text
-        if len(pyacc.union_text) == 0 else
-          pyacc.after_union_text
+          _ast.before_union_text
+        if len(_ast.union_text) == 0 else
+          _ast.after_union_text
         ).append(self[0])
 
     class PureParser(Item):
       # GENERATE ELEMENT() BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Section1_PureParser',
+        tag = 'AST_Section1_PureParser',
         attrib = {},
         text = '',
         children = []
@@ -2117,11 +2117,11 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Section1.PureParser({0:s})'.format(', '.join(params))
+        return 'ast.AST.Section1.PureParser({0:s})'.format(', '.join(params))
       # GENERATE END
       def post_process(
         self,
-        pyacc,
+        _ast,
         section,
         character_to_symbol,
         name_to_symbol,
@@ -2134,7 +2134,7 @@ class PYACC(element.Element):
       # GENERATE ELEMENT() BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Section1_Require',
+        tag = 'AST_Section1_Require',
         attrib = {},
         text = '',
         children = []
@@ -2155,14 +2155,14 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Section1.Require({0:s})'.format(', '.join(params))
+        return 'ast.AST.Section1.Require({0:s})'.format(', '.join(params))
       # GENERATE END
 
     class Skeleton(Item):
       # GENERATE ELEMENT() BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Section1_Skeleton',
+        tag = 'AST_Section1_Skeleton',
         attrib = {},
         text = '',
         children = []
@@ -2183,14 +2183,14 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Section1.Skeleton({0:s})'.format(', '.join(params))
+        return 'ast.AST.Section1.Skeleton({0:s})'.format(', '.join(params))
       # GENERATE END
 
     class TokenTable(Item):
       # GENERATE ELEMENT() BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Section1_TokenTable',
+        tag = 'AST_Section1_TokenTable',
         attrib = {},
         text = '',
         children = []
@@ -2211,14 +2211,14 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Section1.TokenTable({0:s})'.format(', '.join(params))
+        return 'ast.AST.Section1.TokenTable({0:s})'.format(', '.join(params))
       # GENERATE END
 
     class Verbose(Item):
       # GENERATE ELEMENT() BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Section1_Verbose',
+        tag = 'AST_Section1_Verbose',
         attrib = {},
         text = '',
         children = []
@@ -2239,11 +2239,11 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Section1.Verbose({0:s})'.format(', '.join(params))
+        return 'ast.AST.Section1.Verbose({0:s})'.format(', '.join(params))
       # GENERATE END
       def post_process(
         self,
-        pyacc,
+        _ast,
         section,
         character_to_symbol,
         name_to_symbol,
@@ -2256,7 +2256,7 @@ class PYACC(element.Element):
       # GENERATE ELEMENT() BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Section1_YACC',
+        tag = 'AST_Section1_YACC',
         attrib = {},
         text = '',
         children = []
@@ -2277,13 +2277,13 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Section1.YACC({0:s})'.format(', '.join(params))
+        return 'ast.AST.Section1.YACC({0:s})'.format(', '.join(params))
       # GENERATE END
 
     # GENERATE ELEMENT(str type_prefix, str name_prefix, int api_pure, bool locations, bool error_verbose, str parse_lac, bool debug, bool defines, int expect, bool verbose) BEGIN
     def __init__(
       self,
-      tag = 'PYACC_Section1',
+      tag = 'AST_Section1',
       attrib = {},
       text = '',
       children = [],
@@ -2298,7 +2298,7 @@ class PYACC(element.Element):
       expect = -1,
       verbose = False
     ):
-      PYACC.Section1Or2.__init__(
+      AST.Section1Or2.__init__(
         self,
         tag,
         attrib,
@@ -2344,7 +2344,7 @@ class PYACC(element.Element):
         verbose
       )
     def serialize(self, ref_list):
-      PYACC.Section1Or2.serialize(self, ref_list)
+      AST.Section1Or2.serialize(self, ref_list)
       self.set('type_prefix', element.serialize_str(self.type_prefix))
       self.set('name_prefix', element.serialize_str(self.name_prefix))
       self.set('api_pure', element.serialize_int(self.api_pure))
@@ -2356,7 +2356,7 @@ class PYACC(element.Element):
       self.set('expect', element.serialize_int(self.expect))
       self.set('verbose', element.serialize_bool(self.verbose))
     def deserialize(self, ref_list):
-      PYACC.Section1Or2.deserialize(self, ref_list)
+      AST.Section1Or2.deserialize(self, ref_list)
       self.type_prefix = element.deserialize_str(self.get('type_prefix', ''))
       self.name_prefix = element.deserialize_str(self.get('name_prefix', ''))
       self.api_pure = element.deserialize_int(self.get('api_pure', '-1'))
@@ -2368,7 +2368,7 @@ class PYACC(element.Element):
       self.expect = element.deserialize_int(self.get('expect', '-1'))
       self.verbose = element.deserialize_bool(self.get('verbose', 'false'))
     def copy(self, factory = None):
-      result = PYACC.Section1Or2.copy(
+      result = AST.Section1Or2.copy(
         self,
         Section1 if factory is None else factory
       )
@@ -2384,7 +2384,7 @@ class PYACC(element.Element):
       result.verbose = self.verbose
       return result
     def repr_serialize(self, params):
-      PYACC.Section1Or2.repr_serialize(self, params)
+      AST.Section1Or2.repr_serialize(self, params)
       if self.type_prefix != '':
         params.append(
           'type_prefix = {0:s}'.format(repr(self.type_prefix))
@@ -2428,11 +2428,11 @@ class PYACC(element.Element):
     def __repr__(self):
       params = []
       self.repr_serialize(params)
-      return 'ast.PYACC.Section1({0:s})'.format(', '.join(params))
+      return 'ast.AST.Section1({0:s})'.format(', '.join(params))
     # GENERATE END
     def post_process(
       self,
-      pyacc,
+      _ast,
       character_to_symbol,
       name_to_symbol,
       string_to_symbol,
@@ -2448,9 +2448,9 @@ class PYACC(element.Element):
       self.defines = False
       self.expect = -1
       self.verbose = False
-      PYACC.Section1Or2.post_process(
+      AST.Section1Or2.post_process(
         self,
-        pyacc,
+        _ast,
         character_to_symbol,
         name_to_symbol,
         string_to_symbol,
@@ -2482,7 +2482,7 @@ class PYACC(element.Element):
       # GENERATE ELEMENT() BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Section2_Rules',
+        tag = 'AST_Section2_Rules',
         attrib = {},
         text = '',
         children = []
@@ -2503,11 +2503,11 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Section2.Rules({0:s})'.format(', '.join(params))
+        return 'ast.AST.Section2.Rules({0:s})'.format(', '.join(params))
       # GENERATE END
       def post_process(
         self,
-        pyacc,
+        _ast,
         section,
         character_to_symbol,
         name_to_symbol,
@@ -2515,21 +2515,21 @@ class PYACC(element.Element):
         name_to_tag
       ):
         _, lhs_nonterminal = self[0].post_process(
-          pyacc,
+          _ast,
           section,
           character_to_symbol,
           name_to_symbol,
           string_to_symbol,
           name_to_tag,
-          PYACC.Symbol.TYPE_NONTERMINAL, # _type
+          AST.Symbol.TYPE_NONTERMINAL, # _type
           -1, # _tag
           -1 # precedence
         )
-        if pyacc.first_nonterminal == -1:
-          pyacc.first_nonterminal = lhs_nonterminal
+        if _ast.first_nonterminal == -1:
+          _ast.first_nonterminal = lhs_nonterminal
         for i in self[1:]:
           i.post_process(
-            pyacc,
+            _ast,
             section,
             lhs_nonterminal,
             character_to_symbol,
@@ -2541,12 +2541,12 @@ class PYACC(element.Element):
     # GENERATE ELEMENT() BEGIN
     def __init__(
       self,
-      tag = 'PYACC_Section2',
+      tag = 'AST_Section2',
       attrib = {},
       text = '',
       children = []
     ):
-      PYACC.Section1Or2.__init__(
+      AST.Section1Or2.__init__(
         self,
         tag,
         attrib,
@@ -2554,7 +2554,7 @@ class PYACC(element.Element):
         children
       )
     def copy(self, factory = None):
-      result = PYACC.Section1Or2.copy(
+      result = AST.Section1Or2.copy(
         self,
         Section2 if factory is None else factory
       )
@@ -2562,14 +2562,14 @@ class PYACC(element.Element):
     def __repr__(self):
       params = []
       self.repr_serialize(params)
-      return 'ast.PYACC.Section2({0:s})'.format(', '.join(params))
+      return 'ast.AST.Section2({0:s})'.format(', '.join(params))
     # GENERATE END
 
   class String(element.Element):
     # GENERATE ELEMENT() BEGIN
     def __init__(
       self,
-      tag = 'PYACC_String',
+      tag = 'AST_String',
       attrib = {},
       text = '',
       children = []
@@ -2590,14 +2590,14 @@ class PYACC(element.Element):
     def __repr__(self):
       params = []
       self.repr_serialize(params)
-      return 'ast.PYACC.String({0:s})'.format(', '.join(params))
+      return 'ast.AST.String({0:s})'.format(', '.join(params))
     # GENERATE END
 
   class TagOrSymbolRef(element.Element):
     # GENERATE ELEMENT() BEGIN
     def __init__(
       self,
-      tag = 'PYACC_TagOrSymbolRef',
+      tag = 'AST_TagOrSymbolRef',
       attrib = {},
       text = '',
       children = []
@@ -2618,11 +2618,11 @@ class PYACC(element.Element):
     def __repr__(self):
       params = []
       self.repr_serialize(params)
-      return 'ast.PYACC.TagOrSymbolRef({0:s})'.format(', '.join(params))
+      return 'ast.AST.TagOrSymbolRef({0:s})'.format(', '.join(params))
     # GENERATE END
     def post_process(
       self,
-      pyacc,
+      _ast,
       section,
       character_to_symbol,
       name_to_symbol,
@@ -2638,12 +2638,12 @@ class PYACC(element.Element):
     # GENERATE ELEMENT() BEGIN
     def __init__(
       self,
-      tag = 'PYACC_TagRef',
+      tag = 'AST_TagRef',
       attrib = {},
       text = '',
       children = []
     ):
-      PYACC.TagOrSymbolRef.__init__(
+      AST.TagOrSymbolRef.__init__(
         self,
         tag,
         attrib,
@@ -2651,7 +2651,7 @@ class PYACC(element.Element):
         children
       )
     def copy(self, factory = None):
-      result = PYACC.TagOrSymbolRef.copy(
+      result = AST.TagOrSymbolRef.copy(
         self,
         TagRef if factory is None else factory
       )
@@ -2659,11 +2659,11 @@ class PYACC(element.Element):
     def __repr__(self):
       params = []
       self.repr_serialize(params)
-      return 'ast.PYACC.TagRef({0:s})'.format(', '.join(params))
+      return 'ast.AST.TagRef({0:s})'.format(', '.join(params))
     # GENERATE END
     def post_process(
       self,
-      pyacc,
+      _ast,
       section,
       character_to_symbol,
       name_to_symbol,
@@ -2677,10 +2677,10 @@ class PYACC(element.Element):
       if name in name_to_tag:
         _tag = name_to_tag[name]
       else:
-        _tag = len(pyacc.tags)
+        _tag = len(_ast.tags)
         name_to_tag[name] = _tag
-        pyacc.tags.append(
-          PYACC.Tag(name = name, code_props = [None, None])
+        _ast.tags.append(
+          AST.Tag(name = name, code_props = [None, None])
         )
       return (_tag, ~_tag)
 
@@ -2688,13 +2688,13 @@ class PYACC(element.Element):
     # GENERATE ELEMENT(int user_token) BEGIN
     def __init__(
       self,
-      tag = 'PYACC_SymbolRef',
+      tag = 'AST_SymbolRef',
       attrib = {},
       text = '',
       children = [],
       user_token = -1
     ):
-      PYACC.TagOrSymbolRef.__init__(
+      AST.TagOrSymbolRef.__init__(
         self,
         tag,
         attrib,
@@ -2707,20 +2707,20 @@ class PYACC(element.Element):
         user_token
       )
     def serialize(self, ref_list):
-      PYACC.TagOrSymbolRef.serialize(self, ref_list)
+      AST.TagOrSymbolRef.serialize(self, ref_list)
       self.set('user_token', element.serialize_int(self.user_token))
     def deserialize(self, ref_list):
-      PYACC.TagOrSymbolRef.deserialize(self, ref_list)
+      AST.TagOrSymbolRef.deserialize(self, ref_list)
       self.user_token = element.deserialize_int(self.get('user_token', '-1'))
     def copy(self, factory = None):
-      result = PYACC.TagOrSymbolRef.copy(
+      result = AST.TagOrSymbolRef.copy(
         self,
         SymbolRef if factory is None else factory
       )
       result.user_token = self.user_token
       return result
     def repr_serialize(self, params):
-      PYACC.TagOrSymbolRef.repr_serialize(self, params)
+      AST.TagOrSymbolRef.repr_serialize(self, params)
       if self.user_token != -1:
         params.append(
           'user_token = {0:s}'.format(repr(self.user_token))
@@ -2728,11 +2728,11 @@ class PYACC(element.Element):
     def __repr__(self):
       params = []
       self.repr_serialize(params)
-      return 'ast.PYACC.SymbolRef({0:s})'.format(', '.join(params))
+      return 'ast.AST.SymbolRef({0:s})'.format(', '.join(params))
     # GENERATE END
     def post_process(
       self,
-      pyacc,
+      _ast,
       section,
       character_to_symbol,
       name_to_symbol,
@@ -2742,22 +2742,22 @@ class PYACC(element.Element):
       _tag,
       precedence
     ):
-      if isinstance(self[0], PYACC.Char):
+      if isinstance(self[0], AST.Char):
         character = ord(self[0][0].get_text())
         assert character != 0 # would conflict with YYEOF
         if character in character_to_symbol:
           symbol = character_to_symbol[character]
         else:
-          symbol = len(pyacc.symbols)
+          symbol = len(_ast.symbols)
           character_to_symbol[character] = symbol
-          pyacc.symbols.append(
-            PYACC.Symbol(
+          _ast.symbols.append(
+            AST.Symbol(
               code_props = [None, None],
-              _type = PYACC.Symbol.TYPE_TERMINAL,
+              _type = AST.Symbol.TYPE_TERMINAL,
               character_set = [character, character + 1]
             )
           )
-      elif isinstance(self[0], PYACC.ID):
+      elif isinstance(self[0], AST.ID):
         name = self[0].get_text()
         if name in name_to_symbol:
           symbol = name_to_symbol[name]
@@ -2769,23 +2769,23 @@ class PYACC(element.Element):
           # it have internal token number 0 (and apparently they don't)
           symbol = 0
           name_to_symbol[name] = symbol
-          assert pyacc.symbols[symbol].name == '$end'
-          pyacc.symbols[symbol] = PYACC.Symbol(
+          assert _ast.symbols[symbol].name == '$end'
+          _ast.symbols[symbol] = AST.Symbol(
             name = name,
             code_props = [None, None],
             character_set = []
           )
         else:
-          symbol = len(pyacc.symbols)
+          symbol = len(_ast.symbols)
           name_to_symbol[name] = symbol
-          pyacc.symbols.append(
-            PYACC.Symbol(
+          _ast.symbols.append(
+            AST.Symbol(
               name = name,
               code_props = [None, None],
               character_set = []
             )
           )
-      elif isinstance(self[0], PYACC.String):
+      elif isinstance(self[0], AST.String):
         string = self[0][0].get_text()
         symbol = string_to_symbol[string] # must already exist
       else:
@@ -2793,8 +2793,8 @@ class PYACC(element.Element):
 
       # insert information from the SymbolRef element
       if self.user_token != -1:
-        assert len(pyacc.symbols[symbol].character_set) == 0
-        pyacc.symbols[symbol].character_set = (
+        assert len(_ast.symbols[symbol].character_set) == 0
+        _ast.symbols[symbol].character_set = (
           [self.user_token, self.user_token + 1]
         )
       if len(self) >= 2:
@@ -2804,16 +2804,16 @@ class PYACC(element.Element):
 
       # insert information from the calling contexxt
       if _type != -1:
-        if pyacc.symbols[symbol]._type == -1:
-          pyacc.symbols[symbol]._type = _type
+        if _ast.symbols[symbol]._type == -1:
+          _ast.symbols[symbol]._type = _type
         else:
-          assert pyacc.symbols[symbol]._type == _type
+          assert _ast.symbols[symbol]._type == _type
       if _tag != -1:
-        assert pyacc.symbols[symbol]._tag == -1
-        pyacc.symbols[symbol]._tag = _tag
+        assert _ast.symbols[symbol]._tag == -1
+        _ast.symbols[symbol]._tag = _tag
       if precedence != -1:
-        assert pyacc.symbols[symbol].precedence == -1
-        pyacc.symbols[symbol].precedence = precedence
+        assert _ast.symbols[symbol].precedence == -1
+        _ast.symbols[symbol].precedence = precedence
 
       return (_tag, symbol)
 
@@ -2822,7 +2822,7 @@ class PYACC(element.Element):
       # GENERATE ELEMENT() BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Text_Item',
+        tag = 'AST_Text_Item',
         attrib = {},
         text = '',
         children = []
@@ -2843,7 +2843,7 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Text.Item({0:s})'.format(', '.join(params))
+        return 'ast.AST.Text.Item({0:s})'.format(', '.join(params))
       # GENERATE END
       def get_text(self, python = False):
         raise NotImplementedError
@@ -2852,13 +2852,13 @@ class PYACC(element.Element):
       # GENERATE ELEMENT(int character) BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Text_Escape',
+        tag = 'AST_Text_Escape',
         attrib = {},
         text = '',
         children = [],
         character = -1
       ):
-        PYACC.Text.Item.__init__(
+        AST.Text.Item.__init__(
           self,
           tag,
           attrib,
@@ -2871,20 +2871,20 @@ class PYACC(element.Element):
           character
         )
       def serialize(self, ref_list):
-        PYACC.Text.Item.serialize(self, ref_list)
+        AST.Text.Item.serialize(self, ref_list)
         self.set('character', element.serialize_int(self.character))
       def deserialize(self, ref_list):
-        PYACC.Text.Item.deserialize(self, ref_list)
+        AST.Text.Item.deserialize(self, ref_list)
         self.character = element.deserialize_int(self.get('character', '-1'))
       def copy(self, factory = None):
-        result = PYACC.Text.Item.copy(
+        result = AST.Text.Item.copy(
           self,
           Escape if factory is None else factory
         )
         result.character = self.character
         return result
       def repr_serialize(self, params):
-        PYACC.Text.Item.repr_serialize(self, params)
+        AST.Text.Item.repr_serialize(self, params)
         if self.character != -1:
           params.append(
             'character = {0:s}'.format(repr(self.character))
@@ -2892,7 +2892,7 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Text.Escape({0:s})'.format(', '.join(params))
+        return 'ast.AST.Text.Escape({0:s})'.format(', '.join(params))
       # GENERATE END
       def get_text(self, python = False):
         return chr(self.character)
@@ -2901,14 +2901,14 @@ class PYACC(element.Element):
       # GENERATE ELEMENT(int offset, int index) BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Text_StackLocation',
+        tag = 'AST_Text_StackLocation',
         attrib = {},
         text = '',
         children = [],
         offset = -1,
         index = -1
       ):
-        PYACC.Text.Item.__init__(
+        AST.Text.Item.__init__(
           self,
           tag,
           attrib,
@@ -2926,15 +2926,15 @@ class PYACC(element.Element):
           index
         )
       def serialize(self, ref_list):
-        PYACC.Text.Item.serialize(self, ref_list)
+        AST.Text.Item.serialize(self, ref_list)
         self.set('offset', element.serialize_int(self.offset))
         self.set('index', element.serialize_int(self.index))
       def deserialize(self, ref_list):
-        PYACC.Text.Item.deserialize(self, ref_list)
+        AST.Text.Item.deserialize(self, ref_list)
         self.offset = element.deserialize_int(self.get('offset', '-1'))
         self.index = element.deserialize_int(self.get('index', '-1'))
       def copy(self, factory = None):
-        result = PYACC.Text.Item.copy(
+        result = AST.Text.Item.copy(
           self,
           StackLocation if factory is None else factory
         )
@@ -2942,7 +2942,7 @@ class PYACC(element.Element):
         result.index = self.index
         return result
       def repr_serialize(self, params):
-        PYACC.Text.Item.repr_serialize(self, params)
+        AST.Text.Item.repr_serialize(self, params)
         if self.offset != -1:
           params.append(
             'offset = {0:s}'.format(repr(self.offset))
@@ -2954,7 +2954,7 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Text.StackLocation({0:s})'.format(', '.join(params))
+        return 'ast.AST.Text.StackLocation({0:s})'.format(', '.join(params))
       # GENERATE END
       def get_text(self, python = False):
         return (
@@ -2967,7 +2967,7 @@ class PYACC(element.Element):
       # GENERATE ELEMENT(str tag_name, int offset, int index) BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Text_StackReference',
+        tag = 'AST_Text_StackReference',
         attrib = {},
         text = '',
         children = [],
@@ -2975,7 +2975,7 @@ class PYACC(element.Element):
         offset = -1,
         index = -1
       ):
-        PYACC.Text.Item.__init__(
+        AST.Text.Item.__init__(
           self,
           tag,
           attrib,
@@ -2994,17 +2994,17 @@ class PYACC(element.Element):
           index
         )
       def serialize(self, ref_list):
-        PYACC.Text.Item.serialize(self, ref_list)
+        AST.Text.Item.serialize(self, ref_list)
         self.set('tag_name', element.serialize_str(self.tag_name))
         self.set('offset', element.serialize_int(self.offset))
         self.set('index', element.serialize_int(self.index))
       def deserialize(self, ref_list):
-        PYACC.Text.Item.deserialize(self, ref_list)
+        AST.Text.Item.deserialize(self, ref_list)
         self.tag_name = element.deserialize_str(self.get('tag_name', ''))
         self.offset = element.deserialize_int(self.get('offset', '-1'))
         self.index = element.deserialize_int(self.get('index', '-1'))
       def copy(self, factory = None):
-        result = PYACC.Text.Item.copy(
+        result = AST.Text.Item.copy(
           self,
           StackReference if factory is None else factory
         )
@@ -3013,7 +3013,7 @@ class PYACC(element.Element):
         result.index = self.index
         return result
       def repr_serialize(self, params):
-        PYACC.Text.Item.repr_serialize(self, params)
+        AST.Text.Item.repr_serialize(self, params)
         if self.tag_name != '':
           params.append(
             'tag_name = {0:s}'.format(repr(self.tag_name))
@@ -3029,7 +3029,7 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Text.StackReference({0:s})'.format(', '.join(params))
+        return 'ast.AST.Text.StackReference({0:s})'.format(', '.join(params))
       # GENERATE END
       def get_text(self, python = False):
         return (
@@ -3060,12 +3060,12 @@ class PYACC(element.Element):
       # GENERATE ELEMENT() BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Text_ValueLocation',
+        tag = 'AST_Text_ValueLocation',
         attrib = {},
         text = '',
         children = []
       ):
-        PYACC.Text.Item.__init__(
+        AST.Text.Item.__init__(
           self,
           tag,
           attrib,
@@ -3073,7 +3073,7 @@ class PYACC(element.Element):
           children
         )
       def copy(self, factory = None):
-        result = PYACC.Text.Item.copy(
+        result = AST.Text.Item.copy(
           self,
           ValueLocation if factory is None else factory
         )
@@ -3081,7 +3081,7 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Text.ValueLocation({0:s})'.format(', '.join(params))
+        return 'ast.AST.Text.ValueLocation({0:s})'.format(', '.join(params))
       # GENERATE END
       def get_text(self, python = False):
         return '(yyloc)'
@@ -3090,13 +3090,13 @@ class PYACC(element.Element):
       # GENERATE ELEMENT(str tag_name) BEGIN
       def __init__(
         self,
-        tag = 'PYACC_Text_ValueReference',
+        tag = 'AST_Text_ValueReference',
         attrib = {},
         text = '',
         children = [],
         tag_name = ''
       ):
-        PYACC.Text.Item.__init__(
+        AST.Text.Item.__init__(
           self,
           tag,
           attrib,
@@ -3105,20 +3105,20 @@ class PYACC(element.Element):
         )
         self.tag_name = tag_name
       def serialize(self, ref_list):
-        PYACC.Text.Item.serialize(self, ref_list)
+        AST.Text.Item.serialize(self, ref_list)
         self.set('tag_name', element.serialize_str(self.tag_name))
       def deserialize(self, ref_list):
-        PYACC.Text.Item.deserialize(self, ref_list)
+        AST.Text.Item.deserialize(self, ref_list)
         self.tag_name = element.deserialize_str(self.get('tag_name', ''))
       def copy(self, factory = None):
-        result = PYACC.Text.Item.copy(
+        result = AST.Text.Item.copy(
           self,
           ValueReference if factory is None else factory
         )
         result.tag_name = self.tag_name
         return result
       def repr_serialize(self, params):
-        PYACC.Text.Item.repr_serialize(self, params)
+        AST.Text.Item.repr_serialize(self, params)
         if self.tag_name != '':
           params.append(
             'tag_name = {0:s}'.format(repr(self.tag_name))
@@ -3126,7 +3126,7 @@ class PYACC(element.Element):
       def __repr__(self):
         params = []
         self.repr_serialize(params)
-        return 'ast.PYACC.Text.ValueReference({0:s})'.format(', '.join(params))
+        return 'ast.AST.Text.ValueReference({0:s})'.format(', '.join(params))
       # GENERATE END
       def get_text(self, python = False):
         return (
@@ -3138,7 +3138,7 @@ class PYACC(element.Element):
     # GENERATE ELEMENT() BEGIN
     def __init__(
       self,
-      tag = 'PYACC_Text',
+      tag = 'AST_Text',
       attrib = {},
       text = '',
       children = []
@@ -3159,7 +3159,7 @@ class PYACC(element.Element):
     def __repr__(self):
       params = []
       self.repr_serialize(params)
-      return 'ast.PYACC.Text({0:s})'.format(', '.join(params))
+      return 'ast.AST.Text({0:s})'.format(', '.join(params))
     # GENERATE END
     def get_text(self, python = False):
       return ''.join(
@@ -3175,7 +3175,7 @@ class PYACC(element.Element):
     # GENERATE ELEMENT() BEGIN
     def __init__(
       self,
-      tag = 'PYACC_BracedCode',
+      tag = 'AST_BracedCode',
       attrib = {},
       text = '',
       children = []
@@ -3196,19 +3196,19 @@ class PYACC(element.Element):
     def __repr__(self):
       params = []
       self.repr_serialize(params)
-      return 'ast.PYACC.BracedCode({0:s})'.format(', '.join(params))
+      return 'ast.AST.BracedCode({0:s})'.format(', '.join(params))
     # GENERATE END
 
   class ID(Text):
     # GENERATE ELEMENT() BEGIN
     def __init__(
       self,
-      tag = 'PYACC_ID',
+      tag = 'AST_ID',
       attrib = {},
       text = '',
       children = []
     ):
-      PYACC.Text.__init__(
+      AST.Text.__init__(
         self,
         tag,
         attrib,
@@ -3216,7 +3216,7 @@ class PYACC(element.Element):
         children
       )
     def copy(self, factory = None):
-      result = PYACC.Text.copy(
+      result = AST.Text.copy(
         self,
         ID if factory is None else factory
       )
@@ -3224,19 +3224,19 @@ class PYACC(element.Element):
     def __repr__(self):
       params = []
       self.repr_serialize(params)
-      return 'ast.PYACC.ID({0:s})'.format(', '.join(params))
+      return 'ast.AST.ID({0:s})'.format(', '.join(params))
     # GENERATE END
 
   class Section3(Text):
     # GENERATE ELEMENT() BEGIN
     def __init__(
       self,
-      tag = 'PYACC_Section3',
+      tag = 'AST_Section3',
       attrib = {},
       text = '',
       children = []
     ):
-      PYACC.Text.__init__(
+      AST.Text.__init__(
         self,
         tag,
         attrib,
@@ -3244,7 +3244,7 @@ class PYACC(element.Element):
         children
       )
     def copy(self, factory = None):
-      result = PYACC.Text.copy(
+      result = AST.Text.copy(
         self,
         Section3 if factory is None else factory
       )
@@ -3252,11 +3252,11 @@ class PYACC(element.Element):
     def __repr__(self):
       params = []
       self.repr_serialize(params)
-      return 'ast.PYACC.Section3({0:s})'.format(', '.join(params))
+      return 'ast.AST.Section3({0:s})'.format(', '.join(params))
     # GENERATE END
     def post_process(
       self,
-      pyacc,
+      _ast,
       character_to_symbol,
       name_to_symbol,
       string_to_symbol,
@@ -3267,7 +3267,7 @@ class PYACC(element.Element):
   # GENERATE ELEMENT(list(ref) top_text, list(ref) before_union_text, list(ref) requires_text, str union_name, list(ref) union_text, list(ref) after_union_text, list(ref) initial_action_text, list(ref) tags, list(ref) symbols, int n_productions, list(ref) productions, int first_nonterminal, int start_nonterminal, list(int) associativities) BEGIN
   def __init__(
     self,
-    tag = 'PYACC',
+    tag = 'AST',
     attrib = {},
     text = '',
     children = [],
@@ -3418,7 +3418,7 @@ class PYACC(element.Element):
   def copy(self, factory = None):
     result = element.Element.copy(
       self,
-      PYACC if factory is None else factory
+      AST if factory is None else factory
     )
     result.top_text = self.top_text
     result.before_union_text = self.before_union_text
@@ -3516,7 +3516,7 @@ class PYACC(element.Element):
   def __repr__(self):
     params = []
     self.repr_serialize(params)
-    return 'ast.PYACC({0:s})'.format(', '.join(params))
+    return 'ast.AST({0:s})'.format(', '.join(params))
   # GENERATE END
 
   def post_process(self):
@@ -3530,27 +3530,27 @@ class PYACC(element.Element):
     self.initial_action_text = []
     self.precedences = 0
     self.symbols = [
-      PYACC.Symbol(
+      AST.Symbol(
         name = '$end',
         code_props = [None, None],
-        _type = PYACC.Symbol.TYPE_TERMINAL,
+        _type = AST.Symbol.TYPE_TERMINAL,
         character_set = [0, 1]
       ),
-      PYACC.Symbol(
+      AST.Symbol(
         name = 'error',
-        _type = PYACC.Symbol.TYPE_TERMINAL,
+        _type = AST.Symbol.TYPE_TERMINAL,
         code_props = [None, None]
       ),
-      PYACC.Symbol(
+      AST.Symbol(
         name = '$undefined',
-        _type = PYACC.Symbol.TYPE_TERMINAL,
+        _type = AST.Symbol.TYPE_TERMINAL,
         code_props = [None, None]
       )
     ]
     # the following stores the destructor and printer for each tag
     self.tags = [
-      PYACC.Tag(name = '', code_props = [None, None]),
-      PYACC.Tag(name = '*', code_props = [None, None]),
+      AST.Tag(name = '', code_props = [None, None]),
+      AST.Tag(name = '*', code_props = [None, None]),
     ]
     self.n_productions = 1 # includes start and midrule action productions
     self.productions = []
@@ -3582,11 +3582,11 @@ class PYACC(element.Element):
     # fill in token numbers that are not characters or overridden by user
     token = 0x100
     for i in self.symbols:
-      if i._type == PYACC.Symbol.TYPE_TERMINAL:
+      if i._type == AST.Symbol.TYPE_TERMINAL:
         if len(i.character_set) == 0:
           i.character_set = [token, token + 1]
           token += 1
-      elif i._type == PYACC.Symbol.TYPE_NONTERMINAL:
+      elif i._type == AST.Symbol.TYPE_NONTERMINAL:
         pass
       else:
         assert False
@@ -3624,7 +3624,7 @@ class PYACC(element.Element):
         [
           i.character_set[-1]
           for i in self.symbols
-          if i._type == PYACC.Symbol.TYPE_TERMINAL
+          if i._type == AST.Symbol.TYPE_TERMINAL
         ]
       ),
       # eof_terminal
@@ -3637,7 +3637,7 @@ class PYACC(element.Element):
       [
         k
         for i in self.symbols
-        if i._type == PYACC.Symbol.TYPE_TERMINAL
+        if i._type == AST.Symbol.TYPE_TERMINAL
         for j in range(0, len(i.character_set), 2)
         for k in [
           (i.character_set[j], True, -1),
@@ -3692,71 +3692,71 @@ class PYACC(element.Element):
 # GENERATE FACTORY(element.Element) BEGIN
 tag_to_class = {
   'Item': Item,
-  'PYACC': PYACC,
-  'PYACC_TagOrSymbol': PYACC.TagOrSymbol,
-  'PYACC_Tag': PYACC.Tag,
-  'PYACC_Symbol': PYACC.Symbol,
-  'PYACC_BracedPredicate': PYACC.BracedPredicate,
-  'PYACC_Char': PYACC.Char,
-  'PYACC_Int': PYACC.Int,
-  'PYACC_Production': PYACC.Production,
-  'PYACC_Production_Item': PYACC.Production.Item,
-  'PYACC_Production_Action': PYACC.Production.Action,
-  'PYACC_Production_DPrec': PYACC.Production.DPrec,
-  'PYACC_Production_Empty': PYACC.Production.Empty,
-  'PYACC_Production_Merge': PYACC.Production.Merge,
-  'PYACC_Production_Prec': PYACC.Production.Prec,
-  'PYACC_Production_SymbolRef': PYACC.Production.SymbolRef,
-  'PYACC_Section1Or2': PYACC.Section1Or2,
-  'PYACC_Section1Or2_Code': PYACC.Section1Or2.Code,
-  'PYACC_Section1Or2_CodeProps': PYACC.Section1Or2.CodeProps,
-  'PYACC_Section1Or2_DefaultPrec': PYACC.Section1Or2.DefaultPrec,
-  'PYACC_Section1Or2_NTerm': PYACC.Section1Or2.NTerm,
-  'PYACC_Section1Or2_Precedence': PYACC.Section1Or2.Precedence,
-  'PYACC_Section1Or2_Start': PYACC.Section1Or2.Start,
-  'PYACC_Section1Or2_Token': PYACC.Section1Or2.Token,
-  'PYACC_Section1Or2_Type': PYACC.Section1Or2.Type,
-  'PYACC_Section1Or2_Union': PYACC.Section1Or2.Union,
-  'PYACC_Section1': PYACC.Section1,
-  'PYACC_Section1_Debug': PYACC.Section1.Debug,
-  'PYACC_Section1_Define': PYACC.Section1.Define,
-  'PYACC_Section1_Defines': PYACC.Section1.Defines,
-  'PYACC_Section1_ErrorVerbose': PYACC.Section1.ErrorVerbose,
-  'PYACC_Section1_Expect': PYACC.Section1.Expect,
-  'PYACC_Section1_ExpectRR': PYACC.Section1.ExpectRR,
-  'PYACC_Section1_FilePrefix': PYACC.Section1.FilePrefix,
-  'PYACC_Section1_GLRParser': PYACC.Section1.GLRParser,
-  'PYACC_Section1_InitialAction': PYACC.Section1.InitialAction,
-  'PYACC_Section1_Language': PYACC.Section1.Language,
-  'PYACC_Section1_Lines': PYACC.Section1.Lines,
-  'PYACC_Section1_Locations': PYACC.Section1.Locations,
-  'PYACC_Section1_NamePrefix': PYACC.Section1.NamePrefix,
-  'PYACC_Section1_NonDeterministicParser': PYACC.Section1.NonDeterministicParser,
-  'PYACC_Section1_Output': PYACC.Section1.Output,
-  'PYACC_Section1_Param': PYACC.Section1.Param,
-  'PYACC_Section1_Prologue': PYACC.Section1.Prologue,
-  'PYACC_Section1_PureParser': PYACC.Section1.PureParser,
-  'PYACC_Section1_Require': PYACC.Section1.Require,
-  'PYACC_Section1_Skeleton': PYACC.Section1.Skeleton,
-  'PYACC_Section1_TokenTable': PYACC.Section1.TokenTable,
-  'PYACC_Section1_Verbose': PYACC.Section1.Verbose,
-  'PYACC_Section1_YACC': PYACC.Section1.YACC,
-  'PYACC_Section2': PYACC.Section2,
-  'PYACC_Section2_Rules': PYACC.Section2.Rules,
-  'PYACC_String': PYACC.String,
-  'PYACC_TagOrSymbolRef': PYACC.TagOrSymbolRef,
-  'PYACC_TagRef': PYACC.TagRef,
-  'PYACC_SymbolRef': PYACC.SymbolRef,
-  'PYACC_Text': PYACC.Text,
-  'PYACC_Text_Item': PYACC.Text.Item,
-  'PYACC_Text_Escape': PYACC.Text.Escape,
-  'PYACC_Text_StackLocation': PYACC.Text.StackLocation,
-  'PYACC_Text_StackReference': PYACC.Text.StackReference,
-  'PYACC_Text_ValueLocation': PYACC.Text.ValueLocation,
-  'PYACC_Text_ValueReference': PYACC.Text.ValueReference,
-  'PYACC_BracedCode': PYACC.BracedCode,
-  'PYACC_ID': PYACC.ID,
-  'PYACC_Section3': PYACC.Section3
+  'AST': AST,
+  'AST_TagOrSymbol': AST.TagOrSymbol,
+  'AST_Tag': AST.Tag,
+  'AST_Symbol': AST.Symbol,
+  'AST_BracedPredicate': AST.BracedPredicate,
+  'AST_Char': AST.Char,
+  'AST_Int': AST.Int,
+  'AST_Production': AST.Production,
+  'AST_Production_Item': AST.Production.Item,
+  'AST_Production_Action': AST.Production.Action,
+  'AST_Production_DPrec': AST.Production.DPrec,
+  'AST_Production_Empty': AST.Production.Empty,
+  'AST_Production_Merge': AST.Production.Merge,
+  'AST_Production_Prec': AST.Production.Prec,
+  'AST_Production_SymbolRef': AST.Production.SymbolRef,
+  'AST_Section1Or2': AST.Section1Or2,
+  'AST_Section1Or2_Code': AST.Section1Or2.Code,
+  'AST_Section1Or2_CodeProps': AST.Section1Or2.CodeProps,
+  'AST_Section1Or2_DefaultPrec': AST.Section1Or2.DefaultPrec,
+  'AST_Section1Or2_NTerm': AST.Section1Or2.NTerm,
+  'AST_Section1Or2_Precedence': AST.Section1Or2.Precedence,
+  'AST_Section1Or2_Start': AST.Section1Or2.Start,
+  'AST_Section1Or2_Token': AST.Section1Or2.Token,
+  'AST_Section1Or2_Type': AST.Section1Or2.Type,
+  'AST_Section1Or2_Union': AST.Section1Or2.Union,
+  'AST_Section1': AST.Section1,
+  'AST_Section1_Debug': AST.Section1.Debug,
+  'AST_Section1_Define': AST.Section1.Define,
+  'AST_Section1_Defines': AST.Section1.Defines,
+  'AST_Section1_ErrorVerbose': AST.Section1.ErrorVerbose,
+  'AST_Section1_Expect': AST.Section1.Expect,
+  'AST_Section1_ExpectRR': AST.Section1.ExpectRR,
+  'AST_Section1_FilePrefix': AST.Section1.FilePrefix,
+  'AST_Section1_GLRParser': AST.Section1.GLRParser,
+  'AST_Section1_InitialAction': AST.Section1.InitialAction,
+  'AST_Section1_Language': AST.Section1.Language,
+  'AST_Section1_Lines': AST.Section1.Lines,
+  'AST_Section1_Locations': AST.Section1.Locations,
+  'AST_Section1_NamePrefix': AST.Section1.NamePrefix,
+  'AST_Section1_NonDeterministicParser': AST.Section1.NonDeterministicParser,
+  'AST_Section1_Output': AST.Section1.Output,
+  'AST_Section1_Param': AST.Section1.Param,
+  'AST_Section1_Prologue': AST.Section1.Prologue,
+  'AST_Section1_PureParser': AST.Section1.PureParser,
+  'AST_Section1_Require': AST.Section1.Require,
+  'AST_Section1_Skeleton': AST.Section1.Skeleton,
+  'AST_Section1_TokenTable': AST.Section1.TokenTable,
+  'AST_Section1_Verbose': AST.Section1.Verbose,
+  'AST_Section1_YACC': AST.Section1.YACC,
+  'AST_Section2': AST.Section2,
+  'AST_Section2_Rules': AST.Section2.Rules,
+  'AST_String': AST.String,
+  'AST_TagOrSymbolRef': AST.TagOrSymbolRef,
+  'AST_TagRef': AST.TagRef,
+  'AST_SymbolRef': AST.SymbolRef,
+  'AST_Text': AST.Text,
+  'AST_Text_Item': AST.Text.Item,
+  'AST_Text_Escape': AST.Text.Escape,
+  'AST_Text_StackLocation': AST.Text.StackLocation,
+  'AST_Text_StackReference': AST.Text.StackReference,
+  'AST_Text_ValueLocation': AST.Text.ValueLocation,
+  'AST_Text_ValueReference': AST.Text.ValueReference,
+  'AST_BracedCode': AST.BracedCode,
+  'AST_ID': AST.ID,
+  'AST_Section3': AST.Section3
 }
 def factory(tag, attrib = {}, *args, **kwargs):
   return tag_to_class.get(tag, element.Element)(tag, attrib, *args, **kwargs)
index bf7d199..7929cce 100644 (file)
@@ -14,8 +14,8 @@ escapes = {
   0x5c: '\\\\'
 }
 
-def generate_bison(pyacc, home_dir, skel_file, out_file, defines_file = None):
-  _lr1dfa = pyacc.to_lr1().to_lalr1()
+def generate_bison(_ast, home_dir, skel_file, out_file, defines_file = None):
+  _lr1dfa = _ast.to_lr1().to_lalr1()
 
   # generate translate table for terminal symbols
   # this undoes yacc/bison's rather wasteful mapping of 0x00..0xff to literal
@@ -27,8 +27,8 @@ def generate_bison(pyacc, home_dir, skel_file, out_file, defines_file = None):
     2, # '$undefined'
     numpy.int16
   )
-  for i in pyacc.symbols:
-    if i._type == ast.PYACC.Symbol.TYPE_TERMINAL:
+  for i in _ast.symbols:
+    if i._type == ast.AST.Symbol.TYPE_TERMINAL:
       for j in range(0, len(i.character_set), 2):
         translate_terminals[
           i.character_set[j]:i.character_set[j + 1]
@@ -46,8 +46,8 @@ def generate_bison(pyacc, home_dir, skel_file, out_file, defines_file = None):
     -1,
     numpy.int16
   )
-  for i in pyacc.symbols:
-    if i._type == ast.PYACC.Symbol.TYPE_NONTERMINAL: 
+  for i in _ast.symbols:
+    if i._type == ast.AST.Symbol.TYPE_NONTERMINAL: 
       for j in range(0, len(i.character_set), 2):
         translate_nonterminals[
           i.character_set[j] - 1:i.character_set[j + 1] - 1
@@ -91,7 +91,7 @@ def generate_bison(pyacc, home_dir, skel_file, out_file, defines_file = None):
 #define YYPURE {0:d}
 /* GENERATE END */
 '''.format(
-                pyacc[0].api_pure
+                _ast[0].api_pure
               ).replace('YY', type_prefix if is_header else 'YY').replace('yy', name_prefix if is_header else 'yy') # hack
             )
           elif line == '/* GENERATE TYPEPREFIX */\n':
@@ -105,17 +105,17 @@ def generate_bison(pyacc, home_dir, skel_file, out_file, defines_file = None):
                       [
                         '#define YY{0:s} {1:s}{2:s}\n'.format(
                           i,
-                          pyacc[0].type_prefix,
+                          _ast[0].type_prefix,
                           i
                         )
                         for i in (
                           ['STYPE'] +
-                          (['LTYPE'] if pyacc[0].locations else [])
+                          (['LTYPE'] if _ast[0].locations else [])
                         )
                       ]
                     )
                   )
-                if pyacc[0].type_prefix != 'YY' else
+                if _ast[0].type_prefix != 'YY' else
                   ''
               )
             )
@@ -130,7 +130,7 @@ def generate_bison(pyacc, home_dir, skel_file, out_file, defines_file = None):
                       [
                         '#define yy{0:s} {1:s}{2:s}\n'.format(
                           i,
-                          pyacc[0].name_prefix,
+                          _ast[0].name_prefix,
                           i
                         )
                         for i in (
@@ -138,15 +138,15 @@ def generate_bison(pyacc, home_dir, skel_file, out_file, defines_file = None):
                           ['parse', 'lex', 'error', 'debug', 'nerrs'] +
                           (
                             []
-                          if pyacc[0].api_pure else
+                          if _ast[0].api_pure else
                             ['lval', 'char'] +
-                            (['lloc'] if pyacc[0].locations else [])
+                            (['lloc'] if _ast[0].locations else [])
                           )
                         )
                       ]
                     )
                   )
-                if pyacc[0].name_prefix != 'yy' else
+                if _ast[0].name_prefix != 'yy' else
                   ''
               )
             )
@@ -158,7 +158,7 @@ def generate_bison(pyacc, home_dir, skel_file, out_file, defines_file = None):
                 ''.join(
                   [
                     '{0:s}\n'.format(i.get_text())
-                    for i in pyacc.top_text
+                    for i in _ast.top_text
                   ]
                 )
               )
@@ -171,7 +171,7 @@ def generate_bison(pyacc, home_dir, skel_file, out_file, defines_file = None):
                 ''.join(
                   [
                     '{0:s}\n'.format(i.get_text())
-                    for i in pyacc.before_union_text
+                    for i in _ast.before_union_text
                   ]
                 )
               )
@@ -187,7 +187,7 @@ def generate_bison(pyacc, home_dir, skel_file, out_file, defines_file = None):
 #endif
 /* GENERATE END */
 '''.format(
-                int(pyacc[0].error_verbose)
+                int(_ast[0].error_verbose)
               )
             )
           elif line == '/* GENERATE SECTION1REQUIRES */\n':
@@ -198,7 +198,7 @@ def generate_bison(pyacc, home_dir, skel_file, out_file, defines_file = None):
                 ''.join(
                   [
                     '{0:s}\n'.format(i.get_text())
-                    for i in pyacc.requires_text
+                    for i in _ast.requires_text
                   ]
                 )
               )
@@ -214,7 +214,7 @@ extern int yydebug;
 #endif
 /* GENERATE END */
 '''.format(
-                int(pyacc[0].debug)
+                int(_ast[0].debug)
               ).replace('YY', type_prefix).replace('yy', name_prefix) # hack
             )
           elif line == '/* GENERATE TOKENSEQUAL */\n':
@@ -225,9 +225,9 @@ extern int yydebug;
                 ','.join(
                   [
                     '\n    {0:s} = {1:d}'.format(i.name, i.character_set[0])
-                    for i in pyacc.symbols[3:]
+                    for i in _ast.symbols[3:]
                     if (
-                      i._type == ast.PYACC.Symbol.TYPE_TERMINAL and
+                      i._type == ast.AST.Symbol.TYPE_TERMINAL and
                       len(i.name)
                     )
                   ]
@@ -242,9 +242,9 @@ extern int yydebug;
                 ''.join(
                   [
                     '#define {0:s} {1:d}\n'.format(i.name, i.character_set[0])
-                    for i in pyacc.symbols[3:]
+                    for i in _ast.symbols[3:]
                     if (
-                      i._type == ast.PYACC.Symbol.TYPE_TERMINAL and
+                      i._type == ast.AST.Symbol.TYPE_TERMINAL and
                       len(i.name)
                     )
                   ]
@@ -268,11 +268,11 @@ typedef union YYSTYPE YYSTYPE;
                     ''.join(
                       [
                         '{0:s}\n'.format(i.get_text())
-                        for i in pyacc.union_text
+                        for i in _ast.union_text
                       ]
                     )
                   )
-                if len(pyacc.union_text) else
+                if len(_ast.union_text) else
                   '''typedef int YYSTYPE;
 '''
               ).replace('YY', type_prefix).replace('yy', name_prefix) # hack
@@ -295,7 +295,7 @@ struct YYLTYPE
 # define YYLTYPE_IS_TRIVIAL 1
 #endif
 '''
-                if pyacc[0].locations else
+                if _ast[0].locations else
                   ''
               ).replace('YY', type_prefix).replace('yy', name_prefix) # hack
             )
@@ -307,7 +307,7 @@ struct YYLTYPE
                 ''.join(
                   [
                     '{0:s}\n'.format(i.get_text())
-                    for i in pyacc.after_union_text
+                    for i in _ast.after_union_text
                   ]
                 )
               )
@@ -335,13 +335,13 @@ struct YYLTYPE
                     '\\\\x{0:02x}'.format(i.character_set[0])
                   )
                 )
-                for i in pyacc.symbols
-                if i._type == ast.PYACC.Symbol.TYPE_TERMINAL
+                for i in _ast.symbols
+                if i._type == ast.AST.Symbol.TYPE_TERMINAL
               ] +
               [
                 '"{0:s}"'.format(i.name)
-                for i in pyacc.symbols
-                if i._type == ast.PYACC.Symbol.TYPE_NONTERMINAL
+                for i in _ast.symbols
+                if i._type == ast.AST.Symbol.TYPE_NONTERMINAL
               ] +
               ['"$@{0:d}"'.format(i) for i in range(n_midrule_actions)] +
               ['YY_NULLPTR']
@@ -519,7 +519,7 @@ static const yytype_int16 yyr2[] =
                   ]
                 ),
                 # YYERROR_VERBOSE (strangely the defined value is repeated)
-                int(pyacc[0].error_verbose),
+                int(_ast[0].error_verbose),
                 # yytname
                 ','.join(
                   ['\n  {0:s}'.format(', '.join(i)) for i in yytname_lines]
@@ -678,7 +678,7 @@ static const yytype_int16 yyr2[] =
                 ''.join(
                   [
                     '{0:s}\n'.format(i.get_text())
-                    for i in pyacc.initial_action_text
+                    for i in _ast.initial_action_text
                   ]
                 ).replace('(yyval)', '(yylval').replace('(yyloc)', '(yylloc)') # hack
               )
@@ -708,7 +708,7 @@ static const yytype_int16 yyr2[] =
               '''/* GENERATE SECTION3 BEGIN */
 {0:s}/*GENERATE END */
 '''.format(
-                '' if len(pyacc) < 3 else pyacc[2].get_text()
+                '' if len(_ast) < 3 else _ast[2].get_text()
               )
             )
           else:
@@ -728,9 +728,9 @@ static const yytype_int16 yyr2[] =
   generate(
     skel_file,
     out_file,
-    pyacc[0].type_prefix,
-    pyacc[0].type_prefix,
-    pyacc[0].name_prefix,
+    _ast[0].type_prefix,
+    _ast[0].type_prefix,
+    _ast[0].name_prefix,
     False
   )
   if defines_file is not None:
@@ -739,8 +739,8 @@ static const yytype_int16 yyr2[] =
         skel_file[:-2] if skel_file[-2:] == '.c' else skel_file
       ),
       defines_file,
-      pyacc[0].type_prefix,
-      pyacc[0].type_prefix,
-      pyacc[0].name_prefix,
+      _ast[0].type_prefix,
+      _ast[0].type_prefix,
+      _ast[0].name_prefix,
       True
     )
index d396190..e3f1ccd 100644 (file)
@@ -2,8 +2,8 @@ import ast
 import os
 import wrap_repr
 
-def pyacc_text_to_python(pyacc_text, indent):
-  text = pyacc_text.get_text(True) # python
+def ast_text_to_python(ast_text, indent):
+  text = ast_text.get_text(True) # python
   text_strip = text.strip()
   if text_strip[:1] == '{' and text_strip[-1:] == '}':
     text = text_strip[1:-1]
@@ -31,8 +31,8 @@ def pyacc_text_to_python(pyacc_text, indent):
       lines[j] = '{0:s}{1:s}\n'.format(indent, lines[j][len(prefix):])
   return ''.join(lines)
 
-def generate_py(pyacc, home_dir, skel_file, out_file, defines_file = None):
-  _lr1dfa = pyacc.to_lr1().to_lalr1()
+def generate_py(_ast, home_dir, skel_file, out_file, defines_file = None):
+  _lr1dfa = _ast.to_lr1().to_lalr1()
   assert _lr1dfa.eof_terminal == 0
   actions = [i for _, i in _lr1dfa.productions]
   _lr1dfa.productions = [
@@ -55,14 +55,14 @@ def generate_py(pyacc, home_dir, skel_file, out_file, defines_file = None):
 '''.format(
               ''.join(
                 [
-                  pyacc_text_to_python(i, '')
-                  for i in pyacc.before_union_text
+                  ast_text_to_python(i, '')
+                  for i in _ast.before_union_text
                 ]
               ),
               ''.join(
                 [
-                  pyacc_text_to_python(i, '')
-                  for i in pyacc.after_union_text
+                  ast_text_to_python(i, '')
+                  for i in _ast.after_union_text
                 ]
               )
             )
@@ -75,9 +75,9 @@ def generate_py(pyacc, home_dir, skel_file, out_file, defines_file = None):
               ''.join(
                 [
                   '{0:s} = {1:d}\n'.format(i.name, i.character_set[0])
-                  for i in pyacc.symbols[3:]
+                  for i in _ast.symbols[3:]
                   if (
-                    i._type == ast.PYACC.Symbol.TYPE_TERMINAL and
+                    i._type == ast.AST.Symbol.TYPE_TERMINAL and
                     len(i.name)
                   )
                 ]
@@ -92,8 +92,8 @@ YYERROR_VERBOSE = {1:s}
 {2:s}{3:s}{4:s}
 # GENERATE END
 '''.format(
-              'True' if pyacc[0].debug else 'False',
-              'True' if pyacc[0].error_verbose else 'False',
+              'True' if _ast[0].debug else 'False',
+              'True' if _ast[0].error_verbose else 'False',
               ''.join(
                 [
                   '''def yy_action{0:d}():
@@ -103,7 +103,7 @@ YYERROR_VERBOSE = {1:s}
                     (
                       '  pass\n'
                     if actions[i] is None else
-                      pyacc_text_to_python(actions[i], '  ')
+                      ast_text_to_python(actions[i], '  ')
                     )
                   )
                   for i in range(len(actions))
@@ -131,7 +131,7 @@ YYERROR_VERBOSE = {1:s}
               ''.join(
                 [
                   plex_text_to_python(i, '  ')
-                  for i in pyacc.initial_action_text
+                  for i in _ast.initial_action_text
                 ]
               ).replace('(yyval)', '(yylval').replace('(yyloc)', '(yylloc)') # hack
             )
@@ -141,7 +141,7 @@ YYERROR_VERBOSE = {1:s}
             '''# GENERATE SECTION3 BEGIN
 {0:s}# GENERATE END
 '''.format(
-              '' if len(pyacc) < 3 else pyacc_text_to_python(pyacc[2], '')
+              '' if len(_ast) < 3 else ast_text_to_python(_ast[2], '')
             )
           )
         else:
similarity index 78%
rename from bootstrap_pyacc.py
rename to piyacc.py
index dc6cfb3..b651c2f 100755 (executable)
+++ b/piyacc.py
@@ -46,14 +46,14 @@ if len(args) < 1:
 in_file = args[0]
 
 with open(in_file) as fin:
-  pyacc = element.deserialize(fin, ast.factory)
-#element.serialize(pyacc, 'a.xml', 'utf-8')
-#pyacc = element.deserialize('a.xml', ast.factory, 'utf-8')
-pyacc.post_process()
-#element.serialize(pyacc, 'b.xml', 'utf-8')
-#pyacc = element.deserialize('b.xml', ast.factory, 'utf-8')
+  _ast = element.deserialize(fin, ast.factory)
+#element.serialize(_ast, 'a.xml', 'utf-8')
+#_ast = element.deserialize('a.xml', ast.factory, 'utf-8')
+_ast.post_process()
+#element.serialize(_ast, 'b.xml', 'utf-8')
+#_ast = element.deserialize('b.xml', ast.factory, 'utf-8')
 (generate_py.generate_py if python else generate_bison.generate_bison)(
-  pyacc,
+  _ast,
   home_dir,
   skel_file,
   out_file,
index 1e8e3bc..4467311 100644 (file)
@@ -1,4 +1,4 @@
-/* A Bison parser, made by pyacc.  */
+/* A Bison parser, made by piyacc.  */
 
 /* Bison implementation for Yacc-like parsers in C
 
index acfb228..36c1397 100644 (file)
@@ -2,7 +2,7 @@
 +++ skel_bison.c       2018-08-10 22:39:51.740019802 +1000
 @@ -1,4 +1,4 @@
 -/* A Bison parser, made by GNU Bison 3.0.5.  */
-+/* A Bison parser, made by pyacc.  */
++/* A Bison parser, made by piyacc.  */
  
  /* Bison implementation for Yacc-like parsers in C
  
index d3b7158..28cdd3f 100644 (file)
@@ -1,4 +1,4 @@
-/* A Bison parser, made by pyacc.  */
+/* A Bison parser, made by piyacc.  */
 
 /* Bison interface for Yacc-like parsers in C
 
index da8e346..6585c59 100644 (file)
@@ -2,7 +2,7 @@
 +++ skel_bison.h       2018-08-10 22:40:03.852019982 +1000
 @@ -1,4 +1,4 @@
 -/* A Bison parser, made by GNU Bison 3.0.5.  */
-+/* A Bison parser, made by pyacc.  */
++/* A Bison parser, made by piyacc.  */
  
  /* Bison interface for Yacc-like parsers in C
  
index b201618..03f50f0 100644 (file)
@@ -3,11 +3,11 @@ all: lex_yy.py y_tab.py cal cal2
 # Python scanner and parser test
 lex_yy.py: cal_py.l
        ../../bootstrap_flex.git/src/flex -o /dev/null $< 2>$<.xml
-       ../../plex2.git/bootstrap_plex.py --python $<.xml
+       ../../pilex.git/pilex.py --python $<.xml
 
 y_tab.py: cal_py.y
        ../../bootstrap_bison.git/src/bison -o /dev/null $< 2>$<.xml
-       ../bootstrap_pyacc.py --python $<.xml
+       ../piyacc.py --python $<.xml
 
 # cal program
 cal: y.tab.o
@@ -17,7 +17,7 @@ y.tab.o: y.tab.c lex.yy.c
 
 y.tab.c: cal.y
        ../../bootstrap_bison.git/src/bison -y -o /dev/null $< 2>$<.xml
-       ../bootstrap_pyacc.py $<.xml
+       ../piyacc.py $<.xml
 
 lex.yy.c: cal.l
        ../../bootstrap_flex.git/src/flex $< 2>$<.xml
@@ -30,8 +30,8 @@ y.tab2.o: y.tab2.c lex.yy.c
 
 y.tab2.c: cal2.y
        ../../bootstrap_bison.git/src/bison -y -o /dev/null $< 2>$<.xml
-       ../bootstrap_pyacc.py -o $@ $<.xml
+       ../piyacc.py -o $@ $<.xml
 
 # other
 clean:
-       rm -f *.c *.o *.py *.xml cal cal2
+       rm -f *.c *.o lex_yy.py y_tab.py *.xml cal cal2