예제 #1
0
def p_fdef(p):
    '''fdef : DEF IDENTIFIER tuple block
    '''

    p[0] = Node('FuncDef')
    p[0].name = p[2].value
    p[0].args = Node('Arguments')
    p[0].args.args = p[3].elems
    p[0].body = p[4].body
예제 #2
0
def p_struct_start(p):
    """struct_start : STRUCT NAME LCURLY"""
    p[0] = Node("struct")
    p[0].name = p[2].value
    p[0].elems = []