Example #1
0
 def parse_program(self):
     # self.current_node = ast.ProgramNode(self.context)
     # self.root_node = self.current_node
     node = self.parse_global()
     nodes = self.parse_e()
     if nodes is not None:
         nodes.insert(0, node)
     else:
         nodes = [node]
     program_node = ast.ProgramNode(self.context, nodes)
     return program_node
Example #2
0
def p_program(p):
    '''program : MAIN block END'''
    p[0] = ast.ProgramNode(block=p[2])
def p_programMultiple(p) :
    '''program : statement ";" program'''
    p[0] = ast.ProgramNode([p[1]] + p[3].children)
def p_program(p) :
    '''program : statement '''
    p[0] = ast.ProgramNode(p[1])