You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1053 lines
26 KiB
1053 lines
26 KiB
{
|
|
"kind" : "Program",
|
|
"location" : [ 2, 1, 92, 11 ],
|
|
"declarations" : [ {
|
|
"kind" : "ClassDef",
|
|
"location" : [ 2, 1, 10, 16 ],
|
|
"name" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 2, 7, 2, 13 ],
|
|
"name" : "A_CLASS"
|
|
},
|
|
"superClass" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 2, 15, 2, 20 ],
|
|
"name" : "object"
|
|
},
|
|
"declarations" : [ {
|
|
"kind" : "VarDef",
|
|
"location" : [ 3, 5, 3, 21 ],
|
|
"var" : {
|
|
"kind" : "TypedVar",
|
|
"location" : [ 3, 5, 3, 17 ],
|
|
"identifier" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 3, 5, 3, 13 ],
|
|
"name" : "a_class_i"
|
|
},
|
|
"type" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 3, 15, 3, 17 ],
|
|
"className" : "int"
|
|
}
|
|
},
|
|
"value" : {
|
|
"kind" : "IntegerLiteral",
|
|
"location" : [ 3, 21, 3, 21 ],
|
|
"value" : 0
|
|
}
|
|
}, {
|
|
"kind" : "FuncDef",
|
|
"location" : [ 4, 5, 5, 18 ],
|
|
"name" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 4, 9, 4, 16 ],
|
|
"errorMsg" : "Method overridden with different type signature: __init__",
|
|
"name" : "__init__"
|
|
},
|
|
"params" : [ {
|
|
"kind" : "TypedVar",
|
|
"location" : [ 4, 18, 4, 31 ],
|
|
"identifier" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 4, 18, 4, 21 ],
|
|
"name" : "self"
|
|
},
|
|
"type" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 4, 23, 4, 31 ],
|
|
"className" : "A_CLASS"
|
|
}
|
|
}, {
|
|
"kind" : "TypedVar",
|
|
"location" : [ 4, 34, 4, 38 ],
|
|
"identifier" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 4, 34, 4, 34 ],
|
|
"name" : "x"
|
|
},
|
|
"type" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 4, 36, 4, 38 ],
|
|
"className" : "int"
|
|
}
|
|
} ],
|
|
"returnType" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 4, 40, 4, 40 ],
|
|
"className" : "<None>"
|
|
},
|
|
"declarations" : [ ],
|
|
"statements" : [ {
|
|
"kind" : "AssignStmt",
|
|
"location" : [ 5, 9, 5, 18 ],
|
|
"targets" : [ {
|
|
"kind" : "MemberExpr",
|
|
"location" : [ 5, 9, 5, 14 ],
|
|
"object" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 5, 9, 5, 12 ],
|
|
"name" : "self"
|
|
},
|
|
"member" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 5, 14, 5, 14 ],
|
|
"name" : "x"
|
|
}
|
|
} ],
|
|
"value" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 5, 18, 5, 18 ],
|
|
"name" : "x"
|
|
}
|
|
} ]
|
|
}, {
|
|
"kind" : "FuncDef",
|
|
"location" : [ 8, 5, 10, 16 ],
|
|
"name" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 8, 9, 8, 11 ],
|
|
"errorMsg" : "First parameter of the following method must be of the enclosing class: add",
|
|
"name" : "add"
|
|
},
|
|
"params" : [ {
|
|
"kind" : "TypedVar",
|
|
"location" : [ 8, 13, 8, 17 ],
|
|
"identifier" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 8, 13, 8, 13 ],
|
|
"name" : "y"
|
|
},
|
|
"type" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 8, 15, 8, 17 ],
|
|
"className" : "int"
|
|
}
|
|
} ],
|
|
"returnType" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 8, 23, 8, 25 ],
|
|
"className" : "int"
|
|
},
|
|
"declarations" : [ ],
|
|
"statements" : [ {
|
|
"kind" : "AssignStmt",
|
|
"location" : [ 9, 9, 9, 20 ],
|
|
"targets" : [ {
|
|
"kind" : "Identifier",
|
|
"location" : [ 9, 9, 9, 9 ],
|
|
"name" : "y"
|
|
} ],
|
|
"value" : {
|
|
"kind" : "BinaryExpr",
|
|
"location" : [ 9, 13, 9, 20 ],
|
|
"left" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 9, 13, 9, 13 ],
|
|
"name" : "y"
|
|
},
|
|
"operator" : "+",
|
|
"right" : {
|
|
"kind" : "MemberExpr",
|
|
"location" : [ 9, 15, 9, 20 ],
|
|
"object" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 9, 15, 9, 18 ],
|
|
"name" : "self"
|
|
},
|
|
"member" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 9, 20, 9, 20 ],
|
|
"name" : "x"
|
|
}
|
|
}
|
|
}
|
|
}, {
|
|
"kind" : "ReturnStmt",
|
|
"location" : [ 10, 9, 10, 16 ],
|
|
"value" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 10, 16, 10, 16 ],
|
|
"name" : "y"
|
|
}
|
|
} ]
|
|
} ]
|
|
}, {
|
|
"kind" : "ClassDef",
|
|
"location" : [ 12, 1, 13, 21 ],
|
|
"name" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 12, 7, 12, 13 ],
|
|
"name" : "B_CLASS"
|
|
},
|
|
"superClass" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 12, 15, 12, 20 ],
|
|
"name" : "object"
|
|
},
|
|
"declarations" : [ {
|
|
"kind" : "VarDef",
|
|
"location" : [ 13, 5, 13, 21 ],
|
|
"var" : {
|
|
"kind" : "TypedVar",
|
|
"location" : [ 13, 5, 13, 17 ],
|
|
"identifier" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 13, 5, 13, 13 ],
|
|
"name" : "b_class_i"
|
|
},
|
|
"type" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 13, 15, 13, 17 ],
|
|
"className" : "int"
|
|
}
|
|
},
|
|
"value" : {
|
|
"kind" : "IntegerLiteral",
|
|
"location" : [ 13, 21, 13, 21 ],
|
|
"value" : 0
|
|
}
|
|
} ]
|
|
}, {
|
|
"kind" : "ClassDef",
|
|
"location" : [ 15, 1, 0, 0 ],
|
|
"name" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 15, 7, 15, 13 ],
|
|
"name" : "C_CLASS"
|
|
},
|
|
"superClass" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 15, 15, 15, 21 ],
|
|
"name" : "B_CLASS"
|
|
},
|
|
"declarations" : [ ]
|
|
}, {
|
|
"kind" : "ClassDef",
|
|
"location" : [ 19, 1, 0, 0 ],
|
|
"name" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 19, 7, 19, 13 ],
|
|
"errorMsg" : "Duplicate declaration of identifier in same scope: A_CLASS",
|
|
"name" : "A_CLASS"
|
|
},
|
|
"superClass" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 19, 15, 19, 20 ],
|
|
"name" : "object"
|
|
},
|
|
"declarations" : [ ]
|
|
}, {
|
|
"kind" : "ClassDef",
|
|
"location" : [ 23, 1, 0, 0 ],
|
|
"name" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 23, 7, 23, 13 ],
|
|
"name" : "D_CLASS"
|
|
},
|
|
"superClass" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 23, 15, 23, 21 ],
|
|
"errorMsg" : "Super-class not defined: E_CLASS",
|
|
"name" : "E_CLASS"
|
|
},
|
|
"declarations" : [ ]
|
|
}, {
|
|
"kind" : "VarDef",
|
|
"location" : [ 28, 1, 28, 15 ],
|
|
"var" : {
|
|
"kind" : "TypedVar",
|
|
"location" : [ 28, 1, 28, 7 ],
|
|
"identifier" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 28, 1, 28, 3 ],
|
|
"name" : "a_s"
|
|
},
|
|
"type" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 28, 5, 28, 7 ],
|
|
"className" : "str"
|
|
}
|
|
},
|
|
"value" : {
|
|
"kind" : "StringLiteral",
|
|
"location" : [ 28, 11, 28, 15 ],
|
|
"value" : "a_s"
|
|
}
|
|
}, {
|
|
"kind" : "VarDef",
|
|
"location" : [ 29, 1, 29, 15 ],
|
|
"var" : {
|
|
"kind" : "TypedVar",
|
|
"location" : [ 29, 1, 29, 7 ],
|
|
"identifier" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 29, 1, 29, 3 ],
|
|
"name" : "b_s"
|
|
},
|
|
"type" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 29, 5, 29, 7 ],
|
|
"className" : "str"
|
|
}
|
|
},
|
|
"value" : {
|
|
"kind" : "StringLiteral",
|
|
"location" : [ 29, 11, 29, 15 ],
|
|
"value" : "b_s"
|
|
}
|
|
}, {
|
|
"kind" : "VarDef",
|
|
"location" : [ 30, 1, 30, 15 ],
|
|
"var" : {
|
|
"kind" : "TypedVar",
|
|
"location" : [ 30, 1, 30, 7 ],
|
|
"identifier" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 30, 1, 30, 3 ],
|
|
"name" : "c_s"
|
|
},
|
|
"type" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 30, 5, 30, 7 ],
|
|
"className" : "str"
|
|
}
|
|
},
|
|
"value" : {
|
|
"kind" : "StringLiteral",
|
|
"location" : [ 30, 11, 30, 15 ],
|
|
"value" : "c_s"
|
|
}
|
|
}, {
|
|
"kind" : "VarDef",
|
|
"location" : [ 32, 1, 32, 11 ],
|
|
"var" : {
|
|
"kind" : "TypedVar",
|
|
"location" : [ 32, 1, 32, 7 ],
|
|
"identifier" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 32, 1, 32, 3 ],
|
|
"name" : "a_i"
|
|
},
|
|
"type" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 32, 5, 32, 7 ],
|
|
"className" : "int"
|
|
}
|
|
},
|
|
"value" : {
|
|
"kind" : "IntegerLiteral",
|
|
"location" : [ 32, 11, 32, 11 ],
|
|
"value" : 0
|
|
}
|
|
}, {
|
|
"kind" : "VarDef",
|
|
"location" : [ 33, 1, 33, 11 ],
|
|
"var" : {
|
|
"kind" : "TypedVar",
|
|
"location" : [ 33, 1, 33, 7 ],
|
|
"identifier" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 33, 1, 33, 3 ],
|
|
"name" : "b_i"
|
|
},
|
|
"type" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 33, 5, 33, 7 ],
|
|
"className" : "int"
|
|
}
|
|
},
|
|
"value" : {
|
|
"kind" : "IntegerLiteral",
|
|
"location" : [ 33, 11, 33, 11 ],
|
|
"value" : 0
|
|
}
|
|
}, {
|
|
"kind" : "VarDef",
|
|
"location" : [ 34, 1, 34, 11 ],
|
|
"var" : {
|
|
"kind" : "TypedVar",
|
|
"location" : [ 34, 1, 34, 7 ],
|
|
"identifier" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 34, 1, 34, 3 ],
|
|
"name" : "c_i"
|
|
},
|
|
"type" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 34, 5, 34, 7 ],
|
|
"className" : "int"
|
|
}
|
|
},
|
|
"value" : {
|
|
"kind" : "IntegerLiteral",
|
|
"location" : [ 34, 11, 34, 11 ],
|
|
"value" : 0
|
|
}
|
|
}, {
|
|
"kind" : "VarDef",
|
|
"location" : [ 36, 1, 36, 16 ],
|
|
"var" : {
|
|
"kind" : "TypedVar",
|
|
"location" : [ 36, 1, 36, 8 ],
|
|
"identifier" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 36, 1, 36, 3 ],
|
|
"name" : "a_b"
|
|
},
|
|
"type" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 36, 5, 36, 8 ],
|
|
"className" : "bool"
|
|
}
|
|
},
|
|
"value" : {
|
|
"kind" : "BooleanLiteral",
|
|
"location" : [ 36, 12, 36, 16 ],
|
|
"value" : false
|
|
}
|
|
}, {
|
|
"kind" : "VarDef",
|
|
"location" : [ 37, 1, 37, 16 ],
|
|
"var" : {
|
|
"kind" : "TypedVar",
|
|
"location" : [ 37, 1, 37, 8 ],
|
|
"identifier" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 37, 1, 37, 3 ],
|
|
"name" : "b_b"
|
|
},
|
|
"type" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 37, 5, 37, 8 ],
|
|
"className" : "bool"
|
|
}
|
|
},
|
|
"value" : {
|
|
"kind" : "BooleanLiteral",
|
|
"location" : [ 37, 12, 37, 16 ],
|
|
"value" : false
|
|
}
|
|
}, {
|
|
"kind" : "VarDef",
|
|
"location" : [ 38, 1, 38, 16 ],
|
|
"var" : {
|
|
"kind" : "TypedVar",
|
|
"location" : [ 38, 1, 38, 8 ],
|
|
"identifier" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 38, 1, 38, 3 ],
|
|
"name" : "c_b"
|
|
},
|
|
"type" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 38, 5, 38, 8 ],
|
|
"className" : "bool"
|
|
}
|
|
},
|
|
"value" : {
|
|
"kind" : "BooleanLiteral",
|
|
"location" : [ 38, 12, 38, 16 ],
|
|
"value" : false
|
|
}
|
|
}, {
|
|
"kind" : "VarDef",
|
|
"location" : [ 40, 1, 40, 19 ],
|
|
"var" : {
|
|
"kind" : "TypedVar",
|
|
"location" : [ 40, 1, 40, 12 ],
|
|
"identifier" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 40, 1, 40, 6 ],
|
|
"name" : "a_list"
|
|
},
|
|
"type" : {
|
|
"kind" : "ListType",
|
|
"location" : [ 40, 8, 40, 12 ],
|
|
"elementType" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 40, 9, 40, 11 ],
|
|
"className" : "int"
|
|
}
|
|
}
|
|
},
|
|
"value" : {
|
|
"kind" : "NoneLiteral",
|
|
"location" : [ 40, 16, 40, 19 ]
|
|
}
|
|
}, {
|
|
"kind" : "VarDef",
|
|
"location" : [ 41, 1, 41, 19 ],
|
|
"var" : {
|
|
"kind" : "TypedVar",
|
|
"location" : [ 41, 1, 41, 12 ],
|
|
"identifier" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 41, 1, 41, 6 ],
|
|
"name" : "b_list"
|
|
},
|
|
"type" : {
|
|
"kind" : "ListType",
|
|
"location" : [ 41, 8, 41, 12 ],
|
|
"elementType" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 41, 9, 41, 11 ],
|
|
"className" : "int"
|
|
}
|
|
}
|
|
},
|
|
"value" : {
|
|
"kind" : "NoneLiteral",
|
|
"location" : [ 41, 16, 41, 19 ]
|
|
}
|
|
}, {
|
|
"kind" : "VarDef",
|
|
"location" : [ 42, 1, 42, 19 ],
|
|
"var" : {
|
|
"kind" : "TypedVar",
|
|
"location" : [ 42, 1, 42, 12 ],
|
|
"identifier" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 42, 1, 42, 6 ],
|
|
"name" : "c_list"
|
|
},
|
|
"type" : {
|
|
"kind" : "ListType",
|
|
"location" : [ 42, 8, 42, 12 ],
|
|
"elementType" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 42, 9, 42, 11 ],
|
|
"className" : "int"
|
|
}
|
|
}
|
|
},
|
|
"value" : {
|
|
"kind" : "NoneLiteral",
|
|
"location" : [ 42, 16, 42, 19 ]
|
|
}
|
|
}, {
|
|
"kind" : "VarDef",
|
|
"location" : [ 44, 1, 44, 22 ],
|
|
"var" : {
|
|
"kind" : "TypedVar",
|
|
"location" : [ 44, 1, 44, 15 ],
|
|
"identifier" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 44, 1, 44, 7 ],
|
|
"name" : "a_class"
|
|
},
|
|
"type" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 44, 9, 44, 15 ],
|
|
"className" : "A_CLASS"
|
|
}
|
|
},
|
|
"value" : {
|
|
"kind" : "NoneLiteral",
|
|
"location" : [ 44, 19, 44, 22 ]
|
|
}
|
|
}, {
|
|
"kind" : "VarDef",
|
|
"location" : [ 45, 1, 45, 22 ],
|
|
"var" : {
|
|
"kind" : "TypedVar",
|
|
"location" : [ 45, 1, 45, 15 ],
|
|
"identifier" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 45, 1, 45, 7 ],
|
|
"name" : "b_class"
|
|
},
|
|
"type" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 45, 9, 45, 15 ],
|
|
"className" : "B_CLASS"
|
|
}
|
|
},
|
|
"value" : {
|
|
"kind" : "NoneLiteral",
|
|
"location" : [ 45, 19, 45, 22 ]
|
|
}
|
|
}, {
|
|
"kind" : "VarDef",
|
|
"location" : [ 46, 1, 46, 22 ],
|
|
"var" : {
|
|
"kind" : "TypedVar",
|
|
"location" : [ 46, 1, 46, 15 ],
|
|
"identifier" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 46, 1, 46, 7 ],
|
|
"name" : "c_class"
|
|
},
|
|
"type" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 46, 9, 46, 15 ],
|
|
"className" : "C_CLASS"
|
|
}
|
|
},
|
|
"value" : {
|
|
"kind" : "NoneLiteral",
|
|
"location" : [ 46, 19, 46, 22 ]
|
|
}
|
|
}, {
|
|
"kind" : "FuncDef",
|
|
"location" : [ 50, 1, 0, 0 ],
|
|
"name" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 50, 5, 50, 7 ],
|
|
"name" : "f_1"
|
|
},
|
|
"params" : [ ],
|
|
"returnType" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 50, 14, 50, 19 ],
|
|
"className" : "object"
|
|
},
|
|
"declarations" : [ {
|
|
"kind" : "FuncDef",
|
|
"location" : [ 51, 5, 54, 18 ],
|
|
"name" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 51, 9, 51, 13 ],
|
|
"name" : "f_f_1"
|
|
},
|
|
"params" : [ ],
|
|
"returnType" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 51, 20, 51, 25 ],
|
|
"className" : "object"
|
|
},
|
|
"declarations" : [ {
|
|
"kind" : "GlobalDecl",
|
|
"location" : [ 53, 9, 53, 18 ],
|
|
"variable" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 53, 16, 53, 18 ],
|
|
"name" : "a_s"
|
|
}
|
|
} ],
|
|
"statements" : [ {
|
|
"kind" : "ExprStmt",
|
|
"location" : [ 54, 9, 54, 18 ],
|
|
"expr" : {
|
|
"kind" : "CallExpr",
|
|
"location" : [ 54, 9, 54, 18 ],
|
|
"function" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 54, 9, 54, 13 ],
|
|
"name" : "print"
|
|
},
|
|
"args" : [ {
|
|
"kind" : "Identifier",
|
|
"location" : [ 54, 15, 54, 17 ],
|
|
"name" : "a_s"
|
|
} ]
|
|
}
|
|
} ]
|
|
} ],
|
|
"statements" : [ ]
|
|
}, {
|
|
"kind" : "FuncDef",
|
|
"location" : [ 58, 1, 0, 0 ],
|
|
"name" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 58, 5, 58, 7 ],
|
|
"name" : "f_2"
|
|
},
|
|
"params" : [ ],
|
|
"returnType" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 58, 14, 58, 19 ],
|
|
"className" : "object"
|
|
},
|
|
"declarations" : [ {
|
|
"kind" : "VarDef",
|
|
"location" : [ 59, 5, 59, 19 ],
|
|
"var" : {
|
|
"kind" : "TypedVar",
|
|
"location" : [ 59, 5, 59, 13 ],
|
|
"identifier" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 59, 5, 59, 9 ],
|
|
"name" : "f_a_s"
|
|
},
|
|
"type" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 59, 11, 59, 13 ],
|
|
"className" : "str"
|
|
}
|
|
},
|
|
"value" : {
|
|
"kind" : "StringLiteral",
|
|
"location" : [ 59, 17, 59, 19 ],
|
|
"value" : "s"
|
|
}
|
|
}, {
|
|
"kind" : "FuncDef",
|
|
"location" : [ 60, 5, 62, 20 ],
|
|
"name" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 60, 9, 60, 13 ],
|
|
"name" : "f_f_2"
|
|
},
|
|
"params" : [ ],
|
|
"returnType" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 60, 20, 60, 25 ],
|
|
"className" : "object"
|
|
},
|
|
"declarations" : [ {
|
|
"kind" : "NonLocalDecl",
|
|
"location" : [ 61, 9, 61, 22 ],
|
|
"variable" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 61, 18, 61, 22 ],
|
|
"name" : "f_a_s"
|
|
}
|
|
} ],
|
|
"statements" : [ {
|
|
"kind" : "ExprStmt",
|
|
"location" : [ 62, 9, 62, 20 ],
|
|
"expr" : {
|
|
"kind" : "CallExpr",
|
|
"location" : [ 62, 9, 62, 20 ],
|
|
"function" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 62, 9, 62, 13 ],
|
|
"name" : "print"
|
|
},
|
|
"args" : [ {
|
|
"kind" : "Identifier",
|
|
"location" : [ 62, 15, 62, 19 ],
|
|
"name" : "f_a_s"
|
|
} ]
|
|
}
|
|
} ]
|
|
} ],
|
|
"statements" : [ ]
|
|
}, {
|
|
"kind" : "FuncDef",
|
|
"location" : [ 66, 1, 72, 16 ],
|
|
"name" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 66, 5, 66, 7 ],
|
|
"name" : "f_3"
|
|
},
|
|
"params" : [ {
|
|
"kind" : "TypedVar",
|
|
"location" : [ 66, 9, 66, 13 ],
|
|
"identifier" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 66, 9, 66, 9 ],
|
|
"name" : "x"
|
|
},
|
|
"type" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 66, 11, 66, 13 ],
|
|
"className" : "int"
|
|
}
|
|
} ],
|
|
"returnType" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 66, 19, 66, 22 ],
|
|
"className" : "bool"
|
|
},
|
|
"declarations" : [ {
|
|
"kind" : "VarDef",
|
|
"location" : [ 67, 5, 67, 17 ],
|
|
"var" : {
|
|
"kind" : "TypedVar",
|
|
"location" : [ 67, 5, 67, 13 ],
|
|
"identifier" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 67, 5, 67, 9 ],
|
|
"name" : "f_b_s"
|
|
},
|
|
"type" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 67, 11, 67, 13 ],
|
|
"className" : "int"
|
|
}
|
|
},
|
|
"value" : {
|
|
"kind" : "IntegerLiteral",
|
|
"location" : [ 67, 17, 67, 17 ],
|
|
"value" : 3
|
|
}
|
|
} ],
|
|
"statements" : [ {
|
|
"kind" : "IfStmt",
|
|
"location" : [ 68, 5, 0, 0 ],
|
|
"condition" : {
|
|
"kind" : "BinaryExpr",
|
|
"location" : [ 68, 9, 68, 21 ],
|
|
"left" : {
|
|
"kind" : "BinaryExpr",
|
|
"location" : [ 68, 9, 68, 17 ],
|
|
"left" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 68, 9, 68, 9 ],
|
|
"name" : "x"
|
|
},
|
|
"operator" : "+",
|
|
"right" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 68, 13, 68, 17 ],
|
|
"name" : "f_b_s"
|
|
}
|
|
},
|
|
"operator" : ">",
|
|
"right" : {
|
|
"kind" : "IntegerLiteral",
|
|
"location" : [ 68, 21, 68, 21 ],
|
|
"value" : 3
|
|
}
|
|
},
|
|
"thenBody" : [ {
|
|
"kind" : "ReturnStmt",
|
|
"location" : [ 69, 9, 69, 19 ],
|
|
"value" : {
|
|
"kind" : "BooleanLiteral",
|
|
"location" : [ 69, 16, 69, 19 ],
|
|
"value" : true
|
|
}
|
|
} ],
|
|
"elseBody" : [ {
|
|
"kind" : "IfStmt",
|
|
"location" : [ 70, 5, 0, 0 ],
|
|
"condition" : {
|
|
"kind" : "BinaryExpr",
|
|
"location" : [ 70, 11, 70, 24 ],
|
|
"left" : {
|
|
"kind" : "BinaryExpr",
|
|
"location" : [ 70, 11, 70, 19 ],
|
|
"left" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 70, 11, 70, 11 ],
|
|
"name" : "x"
|
|
},
|
|
"operator" : "+",
|
|
"right" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 70, 15, 70, 19 ],
|
|
"name" : "f_b_s"
|
|
}
|
|
},
|
|
"operator" : "==",
|
|
"right" : {
|
|
"kind" : "IntegerLiteral",
|
|
"location" : [ 70, 24, 70, 24 ],
|
|
"value" : 3
|
|
}
|
|
},
|
|
"thenBody" : [ {
|
|
"kind" : "ExprStmt",
|
|
"location" : [ 71, 9, 71, 22 ],
|
|
"expr" : {
|
|
"kind" : "CallExpr",
|
|
"location" : [ 71, 9, 71, 22 ],
|
|
"function" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 71, 9, 71, 13 ],
|
|
"name" : "print"
|
|
},
|
|
"args" : [ {
|
|
"kind" : "StringLiteral",
|
|
"location" : [ 71, 15, 71, 21 ],
|
|
"value" : "Equal"
|
|
} ]
|
|
}
|
|
} ],
|
|
"elseBody" : [ ]
|
|
} ]
|
|
}, {
|
|
"kind" : "ReturnStmt",
|
|
"location" : [ 72, 5, 72, 16 ],
|
|
"value" : {
|
|
"kind" : "BooleanLiteral",
|
|
"location" : [ 72, 12, 72, 16 ],
|
|
"value" : false
|
|
}
|
|
} ]
|
|
}, {
|
|
"kind" : "FuncDef",
|
|
"location" : [ 74, 1, 77, 16 ],
|
|
"name" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 74, 5, 74, 7 ],
|
|
"name" : "f_4"
|
|
},
|
|
"params" : [ ],
|
|
"returnType" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 74, 14, 74, 19 ],
|
|
"className" : "object"
|
|
},
|
|
"declarations" : [ {
|
|
"kind" : "VarDef",
|
|
"location" : [ 75, 5, 75, 17 ],
|
|
"var" : {
|
|
"kind" : "TypedVar",
|
|
"location" : [ 75, 5, 75, 13 ],
|
|
"identifier" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 75, 5, 75, 9 ],
|
|
"name" : "f_a_i"
|
|
},
|
|
"type" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 75, 11, 75, 13 ],
|
|
"className" : "int"
|
|
}
|
|
},
|
|
"value" : {
|
|
"kind" : "IntegerLiteral",
|
|
"location" : [ 75, 17, 75, 17 ],
|
|
"value" : 2
|
|
}
|
|
} ],
|
|
"statements" : [ {
|
|
"kind" : "AssignStmt",
|
|
"location" : [ 76, 5, 76, 19 ],
|
|
"targets" : [ {
|
|
"kind" : "Identifier",
|
|
"location" : [ 76, 5, 76, 7 ],
|
|
"name" : "a_i"
|
|
} ],
|
|
"value" : {
|
|
"kind" : "BinaryExpr",
|
|
"location" : [ 76, 11, 76, 19 ],
|
|
"left" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 76, 11, 76, 15 ],
|
|
"name" : "f_a_i"
|
|
},
|
|
"operator" : "+",
|
|
"right" : {
|
|
"kind" : "IntegerLiteral",
|
|
"location" : [ 76, 19, 76, 19 ],
|
|
"value" : 1
|
|
}
|
|
}
|
|
}, {
|
|
"kind" : "ReturnStmt",
|
|
"location" : [ 77, 5, 77, 16 ],
|
|
"value" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 77, 12, 77, 16 ],
|
|
"name" : "f_a_i"
|
|
}
|
|
} ]
|
|
}, {
|
|
"kind" : "FuncDef",
|
|
"location" : [ 81, 1, 0, 0 ],
|
|
"name" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 81, 5, 81, 7 ],
|
|
"errorMsg" : "Duplicate declaration of identifier in same scope: f_2",
|
|
"name" : "f_2"
|
|
},
|
|
"params" : [ ],
|
|
"returnType" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 81, 14, 81, 19 ],
|
|
"className" : "object"
|
|
},
|
|
"declarations" : [ ],
|
|
"statements" : [ ]
|
|
}, {
|
|
"kind" : "FuncDef",
|
|
"location" : [ 85, 1, 0, 0 ],
|
|
"name" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 85, 5, 85, 9 ],
|
|
"errorMsg" : "Duplicate declaration of identifier in same scope: print",
|
|
"name" : "print"
|
|
},
|
|
"params" : [ {
|
|
"kind" : "TypedVar",
|
|
"location" : [ 85, 11, 85, 20 ],
|
|
"identifier" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 85, 11, 85, 13 ],
|
|
"name" : "val"
|
|
},
|
|
"type" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 85, 15, 85, 20 ],
|
|
"className" : "object"
|
|
}
|
|
} ],
|
|
"returnType" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 85, 26, 85, 31 ],
|
|
"className" : "object"
|
|
},
|
|
"declarations" : [ ],
|
|
"statements" : [ ]
|
|
}, {
|
|
"kind" : "VarDef",
|
|
"location" : [ 89, 1, 89, 11 ],
|
|
"var" : {
|
|
"kind" : "TypedVar",
|
|
"location" : [ 89, 1, 89, 7 ],
|
|
"identifier" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 89, 1, 89, 3 ],
|
|
"errorMsg" : "Duplicate declaration of identifier in same scope: a_i",
|
|
"name" : "a_i"
|
|
},
|
|
"type" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 89, 5, 89, 7 ],
|
|
"className" : "int"
|
|
}
|
|
},
|
|
"value" : {
|
|
"kind" : "IntegerLiteral",
|
|
"location" : [ 89, 11, 89, 11 ],
|
|
"value" : 2
|
|
}
|
|
} ],
|
|
"statements" : [ {
|
|
"kind" : "ReturnStmt",
|
|
"location" : [ 92, 1, 92, 10 ],
|
|
"value" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 92, 8, 92, 10 ],
|
|
"name" : "a_i"
|
|
}
|
|
} ],
|
|
"errors" : {
|
|
"errors" : [ {
|
|
"kind" : "CompilerError",
|
|
"location" : [ 19, 7, 19, 13 ],
|
|
"message" : "Duplicate declaration of identifier in same scope: A_CLASS"
|
|
}, {
|
|
"kind" : "CompilerError",
|
|
"location" : [ 23, 15, 23, 21 ],
|
|
"message" : "Super-class not defined: E_CLASS"
|
|
}, {
|
|
"kind" : "CompilerError",
|
|
"location" : [ 81, 5, 81, 7 ],
|
|
"message" : "Duplicate declaration of identifier in same scope: f_2"
|
|
}, {
|
|
"kind" : "CompilerError",
|
|
"location" : [ 85, 5, 85, 9 ],
|
|
"message" : "Duplicate declaration of identifier in same scope: print"
|
|
}, {
|
|
"kind" : "CompilerError",
|
|
"location" : [ 89, 1, 89, 3 ],
|
|
"message" : "Duplicate declaration of identifier in same scope: a_i"
|
|
}, {
|
|
"kind" : "CompilerError",
|
|
"location" : [ 4, 9, 4, 16 ],
|
|
"message" : "Method overridden with different type signature: __init__"
|
|
}, {
|
|
"kind" : "CompilerError",
|
|
"location" : [ 8, 9, 8, 11 ],
|
|
"message" : "First parameter of the following method must be of the enclosing class: add"
|
|
} ],
|
|
"kind" : "Errors",
|
|
"location" : [ 0, 0, 0, 0 ]
|
|
}
|
|
} |