from src.cmp.pycompiler import Grammar
from src.ast_nodes import (
    ProgramNode,
    ClassDeclarationNode,
    FuncDeclarationNode,
    AttrDeclarationNode,
    IfNode,
    WhileNode,
    LetNode,
    CaseNode,
    IsvoidNode,
    AssignNode,
    VarDeclarationNode,
    CaseItemNode,
    NotNode,
    LessNode,
    LessEqualNode,
    EqualNode,
    PlusNode,
    MinusNode,
    StarNode,
    DivNode,
    NegNode,
    InstantiateNode,
    BlockNode,
    CallNode,
    ConstantNumNode,
    VariableNode,
    BooleanNode,
    StringNode,
)


def define_cool_grammar(print_grammar=False):
    # grammar
    G = Grammar()

    # non-terminals
    program = G.NonTerminal("<program>", startSymbol=True)
    class_list, def_class = G.NonTerminals("<class-list> <def-class>")
    feature_list, def_attr, def_func = G.NonTerminals(
        "<feature-list> <def-attr> <def-func>"
    )
    param_list, param = G.NonTerminals("<param-list> <param>")
    expr, comp, arith, term, factor, element, atom = G.NonTerminals(
        "<expr> <comp> <arith> <term> <factor> <element> <atom>"
    )
    identifiers_list, identifier_init = G.NonTerminals("<ident-list> <ident-init>")
    block, case_block, case_item = G.NonTerminals("<block> <case-block> <case-item>")
    func_call, arg_list = G.NonTerminals("<func-call> <arg-list>")

    # terminals
    classx, inherits, notx, isvoid = G.Terminals("class inherits not isvoid")
    let, inx = G.Terminals("let in")
    ifx, then, elsex, fi = G.Terminals("if then else fi")
    whilex, loop, pool = G.Terminals("while loop pool")
    case, of, esac = G.Terminals("case of esac")
    semi, colon, comma, dot, opar, cpar, ocur, ccur, at, larrow, rarrow = G.Terminals(
        "; : , . ( ) { } @ <- =>"
    )
    equal, plus, minus, star, div, less, equal, lesseq, neg = G.Terminals(
        "= + - * / < = <= ~"
    )
    idx, num, new, string, true, false = G.Terminals("id int new string true false")

    # productions
    program %= class_list, lambda h, s: ProgramNode(s[1])

    class_list %= def_class + class_list, lambda h, s: [s[1]] + s[2]
    class_list %= def_class, lambda h, s: [s[1]]

    def_class %= (
        classx + idx + ocur + feature_list + ccur + semi,
        lambda h, s: ClassDeclarationNode(s[2], s[4]),
    )
    def_class %= (
        classx + idx + inherits + idx + ocur + feature_list + ccur + semi,
        lambda h, s: ClassDeclarationNode(s[2], s[6], s[4]),
    )

    feature_list %= def_attr + semi + feature_list, lambda h, s: [s[1]] + s[3]
    feature_list %= def_func + semi + feature_list, lambda h, s: [s[1]] + s[3]
    feature_list %= G.Epsilon, lambda h, s: []

    def_attr %= (
        idx + colon + idx + larrow + expr,
        lambda h, s: AttrDeclarationNode(s[1], s[3], s[5]),
    )
    def_attr %= idx + colon + idx, lambda h, s: AttrDeclarationNode(s[1], s[3])

    def_func %= (
        idx + opar + param_list + cpar + colon + idx + ocur + expr + ccur,
        lambda h, s: FuncDeclarationNode(s[1], s[3], s[6], s[8]),
    )

    param_list %= param + comma + param_list, lambda h, s: [s[1]] + s[3]
    param_list %= param, lambda h, s: [s[1]]
    param_list %= G.Epsilon, lambda h, s: []

    param %= idx + colon + idx, lambda h, s: (s[1], s[3])

    expr %= idx + larrow + expr, lambda h, s: AssignNode(s[1], s[3])
    expr %= let + identifiers_list + inx + expr, lambda h, s: LetNode(s[2], s[4])
    expr %= (
        ifx + expr + then + expr + elsex + expr + fi,
        lambda h, s: IfNode(s[2], s[4], s[6]),
    )
    expr %= whilex + expr + loop + expr + pool, lambda h, s: WhileNode(s[2], s[4])
    expr %= case + expr + of + case_block + esac, lambda h, s: CaseNode(s[2], s[4])
    expr %= notx + expr, lambda h, s: NotNode(s[2])
    expr %= comp, lambda h, s: s[1]

    identifiers_list %= (
        identifier_init + comma + identifiers_list,
        lambda h, s: [s[1]] + s[3],
    )
    identifiers_list %= identifier_init, lambda h, s: [s[1]]

    identifier_init %= (
        idx + colon + idx + larrow + expr,
        lambda h, s: VarDeclarationNode(s[1], s[3], s[5]),
    )
    identifier_init %= idx + colon + idx, lambda h, s: VarDeclarationNode(s[1], s[3])

    case_block %= case_item + case_block, lambda h, s: [s[1]] + s[2]
    case_block %= case_item, lambda h, s: [s[1]]
    case_item %= (
        idx + colon + idx + rarrow + expr + semi,
        lambda h, s: CaseItemNode(s[1], s[3], s[5]),
    )

    comp %= comp + less + arith, lambda h, s: LessNode(s[1], s[3])
    comp %= comp + equal + arith, lambda h, s: EqualNode(s[1], s[3])
    comp %= comp + lesseq + arith, lambda h, s: LessEqualNode(s[1], s[3])
    comp %= arith, lambda h, s: s[1]

    arith %= arith + plus + term, lambda h, s: PlusNode(s[1], s[3])
    arith %= arith + minus + term, lambda h, s: MinusNode(s[1], s[3])
    arith %= term, lambda h, s: s[1]

    term %= term + star + factor, lambda h, s: StarNode(s[1], s[3])
    term %= term + div + factor, lambda h, s: DivNode(s[1], s[3])
    term %= factor, lambda h, s: s[1]

    factor %= isvoid + element, lambda h, s: IsvoidNode(s[2])
    factor %= neg + element, lambda h, s: NegNode(s[2])
    factor %= new + idx, lambda h, s: InstantiateNode(s[2])
    factor %= element, lambda h, s: s[1]

    element %= opar + expr + cpar, lambda h, s: s[2]
    element %= ocur + block + ccur, lambda h, s: BlockNode(s[2])
    element %= (element + dot + func_call, lambda h, s: CallNode(*s[3], obj=s[1]))
    element %= (
        element + at + idx + dot + func_call,
        lambda h, s: CallNode(*s[5], obj=s[1], at_type=s[3]),
    )
    element %= func_call, lambda h, s: CallNode(*s[1])
    element %= atom, lambda h, s: s[1]

    atom %= num, lambda h, s: ConstantNumNode(s[1])
    atom %= idx, lambda h, s: VariableNode(s[1])
    atom %= (
        true,
        lambda h, s: BooleanNode(s[1]),
    )
    atom %= false, lambda h, s: BooleanNode(s[1])
    atom %= string, lambda h, s: StringNode(s[1])

    block %= expr + semi, lambda h, s: [s[1]]
    block %= expr + semi + block, lambda h, s: [s[1]] + s[3]

    func_call %= idx + opar + arg_list + cpar, lambda h, s: (s[1], s[3])

    arg_list %= expr + comma + arg_list, lambda h, s: [s[1]] + s[3]
    arg_list %= expr, lambda h, s: [s[1]]
    arg_list %= G.Epsilon, lambda h, s: []

    if print_grammar:
        print(G)
    return (G, idx, string, num)

[((36, 8, 36, 17), 'src.cmp.pycompiler.Grammar', 'Grammar', ({}, {}), '()', False, 'from src.cmp.pycompiler import Grammar\n'), ((67, 40, 67, 57), 'src.ast_nodes.ProgramNode', 'ProgramNode', ({(67, 52, 67, 56): 's[1]'}, {}), '(s[1])', False, 'from src.ast_nodes import ProgramNode, ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode, IfNode, WhileNode, LetNode, CaseNode, IsvoidNode, AssignNode, VarDeclarationNode, CaseItemNode, NotNode, LessNode, LessEqualNode, EqualNode, PlusNode, MinusNode, StarNode, DivNode, NegNode, InstantiateNode, BlockNode, CallNode, ConstantNumNode, VariableNode, BooleanNode, StringNode\n'), ((74, 21, 74, 53), 'src.ast_nodes.ClassDeclarationNode', 'ClassDeclarationNode', ({(74, 42, 74, 46): 's[2]', (74, 48, 74, 52): 's[4]'}, {}), '(s[2], s[4])', False, 'from src.ast_nodes import ProgramNode, ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode, IfNode, WhileNode, LetNode, CaseNode, IsvoidNode, AssignNode, VarDeclarationNode, CaseItemNode, NotNode, LessNode, LessEqualNode, EqualNode, PlusNode, MinusNode, StarNode, DivNode, NegNode, InstantiateNode, BlockNode, CallNode, ConstantNumNode, VariableNode, BooleanNode, StringNode\n'), ((78, 21, 78, 59), 'src.ast_nodes.ClassDeclarationNode', 'ClassDeclarationNode', ({(78, 42, 78, 46): 's[2]', (78, 48, 78, 52): 's[6]', (78, 54, 78, 58): 's[4]'}, {}), '(s[2], s[6], s[4])', False, 'from src.ast_nodes import ProgramNode, ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode, IfNode, WhileNode, LetNode, CaseNode, IsvoidNode, AssignNode, VarDeclarationNode, CaseItemNode, NotNode, LessNode, LessEqualNode, EqualNode, PlusNode, MinusNode, StarNode, DivNode, NegNode, InstantiateNode, BlockNode, CallNode, ConstantNumNode, VariableNode, BooleanNode, StringNode\n'), ((87, 21, 87, 58), 'src.ast_nodes.AttrDeclarationNode', 'AttrDeclarationNode', ({(87, 41, 87, 45): 's[1]', (87, 47, 87, 51): 's[3]', (87, 53, 87, 57): 's[5]'}, {}), '(s[1], s[3], s[5])', False, 'from src.ast_nodes import ProgramNode, ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode, IfNode, WhileNode, LetNode, CaseNode, IsvoidNode, AssignNode, VarDeclarationNode, CaseItemNode, NotNode, LessNode, LessEqualNode, EqualNode, PlusNode, MinusNode, StarNode, DivNode, NegNode, InstantiateNode, BlockNode, CallNode, ConstantNumNode, VariableNode, BooleanNode, StringNode\n'), ((89, 48, 89, 79), 'src.ast_nodes.AttrDeclarationNode', 'AttrDeclarationNode', ({(89, 68, 89, 72): 's[1]', (89, 74, 89, 78): 's[3]'}, {}), '(s[1], s[3])', False, 'from src.ast_nodes import ProgramNode, ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode, IfNode, WhileNode, LetNode, CaseNode, IsvoidNode, AssignNode, VarDeclarationNode, CaseItemNode, NotNode, LessNode, LessEqualNode, EqualNode, PlusNode, MinusNode, StarNode, DivNode, NegNode, InstantiateNode, BlockNode, CallNode, ConstantNumNode, VariableNode, BooleanNode, StringNode\n'), ((93, 21, 93, 64), 'src.ast_nodes.FuncDeclarationNode', 'FuncDeclarationNode', ({(93, 41, 93, 45): 's[1]', (93, 47, 93, 51): 's[3]', (93, 53, 93, 57): 's[6]', (93, 59, 93, 63): 's[8]'}, {}), '(s[1], s[3], s[6], s[8])', False, 'from src.ast_nodes import ProgramNode, ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode, IfNode, WhileNode, LetNode, CaseNode, IsvoidNode, AssignNode, VarDeclarationNode, CaseItemNode, NotNode, LessNode, LessEqualNode, EqualNode, PlusNode, MinusNode, StarNode, DivNode, NegNode, InstantiateNode, BlockNode, CallNode, ConstantNumNode, VariableNode, BooleanNode, StringNode\n'), ((102, 46, 102, 68), 'src.ast_nodes.AssignNode', 'AssignNode', ({(102, 57, 102, 61): 's[1]', (102, 63, 102, 67): 's[3]'}, {}), '(s[1], s[3])', False, 'from src.ast_nodes import ProgramNode, ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode, IfNode, WhileNode, LetNode, CaseNode, IsvoidNode, AssignNode, VarDeclarationNode, CaseItemNode, NotNode, LessNode, LessEqualNode, EqualNode, PlusNode, MinusNode, StarNode, DivNode, NegNode, InstantiateNode, BlockNode, CallNode, ConstantNumNode, VariableNode, BooleanNode, StringNode\n'), ((103, 62, 103, 81), 'src.ast_nodes.LetNode', 'LetNode', ({(103, 70, 103, 74): 's[2]', (103, 76, 103, 80): 's[4]'}, {}), '(s[2], s[4])', False, 'from src.ast_nodes import ProgramNode, ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode, IfNode, WhileNode, LetNode, CaseNode, IsvoidNode, AssignNode, VarDeclarationNode, CaseItemNode, NotNode, LessNode, LessEqualNode, EqualNode, PlusNode, MinusNode, StarNode, DivNode, NegNode, InstantiateNode, BlockNode, CallNode, ConstantNumNode, VariableNode, BooleanNode, StringNode\n'), ((106, 21, 106, 45), 'src.ast_nodes.IfNode', 'IfNode', ({(106, 28, 106, 32): 's[2]', (106, 34, 106, 38): 's[4]', (106, 40, 106, 44): 's[6]'}, {}), '(s[2], s[4], s[6])', False, 'from src.ast_nodes import ProgramNode, ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode, IfNode, WhileNode, LetNode, CaseNode, IsvoidNode, AssignNode, VarDeclarationNode, CaseItemNode, NotNode, LessNode, LessEqualNode, EqualNode, PlusNode, MinusNode, StarNode, DivNode, NegNode, InstantiateNode, BlockNode, CallNode, ConstantNumNode, VariableNode, BooleanNode, StringNode\n'), ((108, 61, 108, 82), 'src.ast_nodes.WhileNode', 'WhileNode', ({(108, 71, 108, 75): 's[2]', (108, 77, 108, 81): 's[4]'}, {}), '(s[2], s[4])', False, 'from src.ast_nodes import ProgramNode, ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode, IfNode, WhileNode, LetNode, CaseNode, IsvoidNode, AssignNode, VarDeclarationNode, CaseItemNode, NotNode, LessNode, LessEqualNode, EqualNode, PlusNode, MinusNode, StarNode, DivNode, NegNode, InstantiateNode, BlockNode, CallNode, ConstantNumNode, VariableNode, BooleanNode, StringNode\n'), ((109, 63, 109, 83), 'src.ast_nodes.CaseNode', 'CaseNode', ({(109, 72, 109, 76): 's[2]', (109, 78, 109, 82): 's[4]'}, {}), '(s[2], s[4])', False, 'from src.ast_nodes import ProgramNode, ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode, IfNode, WhileNode, LetNode, CaseNode, IsvoidNode, AssignNode, VarDeclarationNode, CaseItemNode, NotNode, LessNode, LessEqualNode, EqualNode, PlusNode, MinusNode, StarNode, DivNode, NegNode, InstantiateNode, BlockNode, CallNode, ConstantNumNode, VariableNode, BooleanNode, StringNode\n'), ((110, 38, 110, 51), 'src.ast_nodes.NotNode', 'NotNode', ({(110, 46, 110, 50): 's[2]'}, {}), '(s[2])', False, 'from src.ast_nodes import ProgramNode, ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode, IfNode, WhileNode, LetNode, CaseNode, IsvoidNode, AssignNode, VarDeclarationNode, CaseItemNode, NotNode, LessNode, LessEqualNode, EqualNode, PlusNode, MinusNode, StarNode, DivNode, NegNode, InstantiateNode, BlockNode, CallNode, ConstantNumNode, VariableNode, BooleanNode, StringNode\n'), ((121, 21, 121, 57), 'src.ast_nodes.VarDeclarationNode', 'VarDeclarationNode', ({(121, 40, 121, 44): 's[1]', (121, 46, 121, 50): 's[3]', (121, 52, 121, 56): 's[5]'}, {}), '(s[1], s[3], s[5])', False, 'from src.ast_nodes import ProgramNode, ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode, IfNode, WhileNode, LetNode, CaseNode, IsvoidNode, AssignNode, VarDeclarationNode, CaseItemNode, NotNode, LessNode, LessEqualNode, EqualNode, PlusNode, MinusNode, StarNode, DivNode, NegNode, InstantiateNode, BlockNode, CallNode, ConstantNumNode, VariableNode, BooleanNode, StringNode\n'), ((123, 55, 123, 85), 'src.ast_nodes.VarDeclarationNode', 'VarDeclarationNode', ({(123, 74, 123, 78): 's[1]', (123, 80, 123, 84): 's[3]'}, {}), '(s[1], s[3])', False, 'from src.ast_nodes import ProgramNode, ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode, IfNode, WhileNode, LetNode, CaseNode, IsvoidNode, AssignNode, VarDeclarationNode, CaseItemNode, NotNode, LessNode, LessEqualNode, EqualNode, PlusNode, MinusNode, StarNode, DivNode, NegNode, InstantiateNode, BlockNode, CallNode, ConstantNumNode, VariableNode, BooleanNode, StringNode\n'), ((129, 21, 129, 51), 'src.ast_nodes.CaseItemNode', 'CaseItemNode', ({(129, 34, 129, 38): 's[1]', (129, 40, 129, 44): 's[3]', (129, 46, 129, 50): 's[5]'}, {}), '(s[1], s[3], s[5])', False, 'from src.ast_nodes import ProgramNode, ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode, IfNode, WhileNode, LetNode, CaseNode, IsvoidNode, AssignNode, VarDeclarationNode, CaseItemNode, NotNode, LessNode, LessEqualNode, EqualNode, PlusNode, MinusNode, StarNode, DivNode, NegNode, InstantiateNode, BlockNode, CallNode, ConstantNumNode, VariableNode, BooleanNode, StringNode\n'), ((132, 46, 132, 66), 'src.ast_nodes.LessNode', 'LessNode', ({(132, 55, 132, 59): 's[1]', (132, 61, 132, 65): 's[3]'}, {}), '(s[1], s[3])', False, 'from src.ast_nodes import ProgramNode, ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode, IfNode, WhileNode, LetNode, CaseNode, IsvoidNode, AssignNode, VarDeclarationNode, CaseItemNode, NotNode, LessNode, LessEqualNode, EqualNode, PlusNode, MinusNode, StarNode, DivNode, NegNode, InstantiateNode, BlockNode, CallNode, ConstantNumNode, VariableNode, BooleanNode, StringNode\n'), ((133, 47, 133, 68), 'src.ast_nodes.EqualNode', 'EqualNode', ({(133, 57, 133, 61): 's[1]', (133, 63, 133, 67): 's[3]'}, {}), '(s[1], s[3])', False, 'from src.ast_nodes import ProgramNode, ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode, IfNode, WhileNode, LetNode, CaseNode, IsvoidNode, AssignNode, VarDeclarationNode, CaseItemNode, NotNode, LessNode, LessEqualNode, EqualNode, PlusNode, MinusNode, StarNode, DivNode, NegNode, InstantiateNode, BlockNode, CallNode, ConstantNumNode, VariableNode, BooleanNode, StringNode\n'), ((134, 48, 134, 73), 'src.ast_nodes.LessEqualNode', 'LessEqualNode', ({(134, 62, 134, 66): 's[1]', (134, 68, 134, 72): 's[3]'}, {}), '(s[1], s[3])', False, 'from src.ast_nodes import ProgramNode, ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode, IfNode, WhileNode, LetNode, CaseNode, IsvoidNode, AssignNode, VarDeclarationNode, CaseItemNode, NotNode, LessNode, LessEqualNode, EqualNode, PlusNode, MinusNode, StarNode, DivNode, NegNode, InstantiateNode, BlockNode, CallNode, ConstantNumNode, VariableNode, BooleanNode, StringNode\n'), ((137, 47, 137, 67), 'src.ast_nodes.PlusNode', 'PlusNode', ({(137, 56, 137, 60): 's[1]', (137, 62, 137, 66): 's[3]'}, {}), '(s[1], s[3])', False, 'from src.ast_nodes import ProgramNode, ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode, IfNode, WhileNode, LetNode, CaseNode, IsvoidNode, AssignNode, VarDeclarationNode, CaseItemNode, NotNode, LessNode, LessEqualNode, EqualNode, PlusNode, MinusNode, StarNode, DivNode, NegNode, InstantiateNode, BlockNode, CallNode, ConstantNumNode, VariableNode, BooleanNode, StringNode\n'), ((138, 48, 138, 69), 'src.ast_nodes.MinusNode', 'MinusNode', ({(138, 58, 138, 62): 's[1]', (138, 64, 138, 68): 's[3]'}, {}), '(s[1], s[3])', False, 'from src.ast_nodes import ProgramNode, ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode, IfNode, WhileNode, LetNode, CaseNode, IsvoidNode, AssignNode, VarDeclarationNode, CaseItemNode, NotNode, LessNode, LessEqualNode, EqualNode, PlusNode, MinusNode, StarNode, DivNode, NegNode, InstantiateNode, BlockNode, CallNode, ConstantNumNode, VariableNode, BooleanNode, StringNode\n'), ((141, 47, 141, 67), 'src.ast_nodes.StarNode', 'StarNode', ({(141, 56, 141, 60): 's[1]', (141, 62, 141, 66): 's[3]'}, {}), '(s[1], s[3])', False, 'from src.ast_nodes import ProgramNode, ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode, IfNode, WhileNode, LetNode, CaseNode, IsvoidNode, AssignNode, VarDeclarationNode, CaseItemNode, NotNode, LessNode, LessEqualNode, EqualNode, PlusNode, MinusNode, StarNode, DivNode, NegNode, InstantiateNode, BlockNode, CallNode, ConstantNumNode, VariableNode, BooleanNode, StringNode\n'), ((142, 46, 142, 65), 'src.ast_nodes.DivNode', 'DivNode', ({(142, 54, 142, 58): 's[1]', (142, 60, 142, 64): 's[3]'}, {}), '(s[1], s[3])', False, 'from src.ast_nodes import ProgramNode, ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode, IfNode, WhileNode, LetNode, CaseNode, IsvoidNode, AssignNode, VarDeclarationNode, CaseItemNode, NotNode, LessNode, LessEqualNode, EqualNode, PlusNode, MinusNode, StarNode, DivNode, NegNode, InstantiateNode, BlockNode, CallNode, ConstantNumNode, VariableNode, BooleanNode, StringNode\n'), ((145, 45, 145, 61), 'src.ast_nodes.IsvoidNode', 'IsvoidNode', ({(145, 56, 145, 60): 's[2]'}, {}), '(s[2])', False, 'from src.ast_nodes import ProgramNode, ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode, IfNode, WhileNode, LetNode, CaseNode, IsvoidNode, AssignNode, VarDeclarationNode, CaseItemNode, NotNode, LessNode, LessEqualNode, EqualNode, PlusNode, MinusNode, StarNode, DivNode, NegNode, InstantiateNode, BlockNode, CallNode, ConstantNumNode, VariableNode, BooleanNode, StringNode\n'), ((146, 42, 146, 55), 'src.ast_nodes.NegNode', 'NegNode', ({(146, 50, 146, 54): 's[2]'}, {}), '(s[2])', False, 'from src.ast_nodes import ProgramNode, ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode, IfNode, WhileNode, LetNode, CaseNode, IsvoidNode, AssignNode, VarDeclarationNode, CaseItemNode, NotNode, LessNode, LessEqualNode, EqualNode, PlusNode, MinusNode, StarNode, DivNode, NegNode, InstantiateNode, BlockNode, CallNode, ConstantNumNode, VariableNode, BooleanNode, StringNode\n'), ((147, 38, 147, 59), 'src.ast_nodes.InstantiateNode', 'InstantiateNode', ({(147, 54, 147, 58): 's[2]'}, {}), '(s[2])', False, 'from src.ast_nodes import ProgramNode, ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode, IfNode, WhileNode, LetNode, CaseNode, IsvoidNode, AssignNode, VarDeclarationNode, CaseItemNode, NotNode, LessNode, LessEqualNode, EqualNode, PlusNode, MinusNode, StarNode, DivNode, NegNode, InstantiateNode, BlockNode, CallNode, ConstantNumNode, VariableNode, BooleanNode, StringNode\n'), ((151, 49, 151, 64), 'src.ast_nodes.BlockNode', 'BlockNode', ({(151, 59, 151, 63): 's[2]'}, {}), '(s[2])', False, 'from src.ast_nodes import ProgramNode, ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode, IfNode, WhileNode, LetNode, CaseNode, IsvoidNode, AssignNode, VarDeclarationNode, CaseItemNode, NotNode, LessNode, LessEqualNode, EqualNode, PlusNode, MinusNode, StarNode, DivNode, NegNode, InstantiateNode, BlockNode, CallNode, ConstantNumNode, VariableNode, BooleanNode, StringNode\n'), ((152, 56, 152, 81), 'src.ast_nodes.CallNode', 'CallNode', (), '', False, 'from src.ast_nodes import ProgramNode, ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode, IfNode, WhileNode, LetNode, CaseNode, IsvoidNode, AssignNode, VarDeclarationNode, CaseItemNode, NotNode, LessNode, LessEqualNode, EqualNode, PlusNode, MinusNode, StarNode, DivNode, NegNode, InstantiateNode, BlockNode, CallNode, ConstantNumNode, VariableNode, BooleanNode, StringNode\n'), ((155, 21, 155, 60), 'src.ast_nodes.CallNode', 'CallNode', (), '', False, 'from src.ast_nodes import ProgramNode, ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode, IfNode, WhileNode, LetNode, CaseNode, IsvoidNode, AssignNode, VarDeclarationNode, CaseItemNode, NotNode, LessNode, LessEqualNode, EqualNode, PlusNode, MinusNode, StarNode, DivNode, NegNode, InstantiateNode, BlockNode, CallNode, ConstantNumNode, VariableNode, BooleanNode, StringNode\n'), ((157, 39, 157, 54), 'src.ast_nodes.CallNode', 'CallNode', ({(157, 48, 157, 53): '*s[1]'}, {}), '(*s[1])', False, 'from src.ast_nodes import ProgramNode, ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode, IfNode, WhileNode, LetNode, CaseNode, IsvoidNode, AssignNode, VarDeclarationNode, CaseItemNode, NotNode, LessNode, LessEqualNode, EqualNode, PlusNode, MinusNode, StarNode, DivNode, NegNode, InstantiateNode, BlockNode, CallNode, ConstantNumNode, VariableNode, BooleanNode, StringNode\n'), ((160, 30, 160, 51), 'src.ast_nodes.ConstantNumNode', 'ConstantNumNode', ({(160, 46, 160, 50): 's[1]'}, {}), '(s[1])', False, 'from src.ast_nodes import ProgramNode, ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode, IfNode, WhileNode, LetNode, CaseNode, IsvoidNode, AssignNode, VarDeclarationNode, CaseItemNode, NotNode, LessNode, LessEqualNode, EqualNode, PlusNode, MinusNode, StarNode, DivNode, NegNode, InstantiateNode, BlockNode, CallNode, ConstantNumNode, VariableNode, BooleanNode, StringNode\n'), ((161, 30, 161, 48), 'src.ast_nodes.VariableNode', 'VariableNode', ({(161, 43, 161, 47): 's[1]'}, {}), '(s[1])', False, 'from src.ast_nodes import ProgramNode, ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode, IfNode, WhileNode, LetNode, CaseNode, IsvoidNode, AssignNode, VarDeclarationNode, CaseItemNode, NotNode, LessNode, LessEqualNode, EqualNode, PlusNode, MinusNode, StarNode, DivNode, NegNode, InstantiateNode, BlockNode, CallNode, ConstantNumNode, VariableNode, BooleanNode, StringNode\n'), ((164, 21, 164, 38), 'src.ast_nodes.BooleanNode', 'BooleanNode', ({(164, 33, 164, 37): 's[1]'}, {}), '(s[1])', False, 'from src.ast_nodes import ProgramNode, ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode, IfNode, WhileNode, LetNode, CaseNode, IsvoidNode, AssignNode, VarDeclarationNode, CaseItemNode, NotNode, LessNode, LessEqualNode, EqualNode, PlusNode, MinusNode, StarNode, DivNode, NegNode, InstantiateNode, BlockNode, CallNode, ConstantNumNode, VariableNode, BooleanNode, StringNode\n'), ((166, 32, 166, 49), 'src.ast_nodes.BooleanNode', 'BooleanNode', ({(166, 44, 166, 48): 's[1]'}, {}), '(s[1])', False, 'from src.ast_nodes import ProgramNode, ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode, IfNode, WhileNode, LetNode, CaseNode, IsvoidNode, AssignNode, VarDeclarationNode, CaseItemNode, NotNode, LessNode, LessEqualNode, EqualNode, PlusNode, MinusNode, StarNode, DivNode, NegNode, InstantiateNode, BlockNode, CallNode, ConstantNumNode, VariableNode, BooleanNode, StringNode\n'), ((167, 33, 167, 49), 'src.ast_nodes.StringNode', 'StringNode', ({(167, 44, 167, 48): 's[1]'}, {}), '(s[1])', False, 'from src.ast_nodes import ProgramNode, ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode, IfNode, WhileNode, LetNode, CaseNode, IsvoidNode, AssignNode, VarDeclarationNode, CaseItemNode, NotNode, LessNode, LessEqualNode, EqualNode, PlusNode, MinusNode, StarNode, DivNode, NegNode, InstantiateNode, BlockNode, CallNode, ConstantNumNode, VariableNode, BooleanNode, StringNode\n')]