Пример #1
0
def p_block(p):
    """
    program : statement
            | program statement
    """
    if len(p) == 2:
        p[0] = ast.Block([p[1]])
    if len(p) == 3:
        p[1].body.append(p[2])
        p[0] = p[1]
Пример #2
0
def p_stmt_list(p):
    """statement_list : statement"""
    p[0] = ast.Block([p[1]])