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.
ChocoPy/src/test/data/pa2/student_contributed/bad_semantic.py.ast

117 lines
2.7 KiB

{
"kind" : "Program",
"location" : [ 1, 1, 13, 8 ],
"declarations" : [ {
"kind" : "VarDef",
"location" : [ 1, 1, 1, 9 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 1, 1, 1, 5 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 1, 1, 1, 1 ],
"name" : "x"
},
"type" : {
"kind" : "ClassType",
"location" : [ 1, 3, 1, 5 ],
"className" : "int"
}
},
"value" : {
"kind" : "IntegerLiteral",
"location" : [ 1, 9, 1, 9 ],
"value" : 1
}
}, {
"kind" : "VarDef",
"location" : [ 2, 1, 2, 9 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 2, 1, 2, 5 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 2, 1, 2, 1 ],
"name" : "x"
},
"type" : {
"kind" : "ClassType",
"location" : [ 2, 3, 2, 5 ],
"className" : "int"
}
},
"value" : {
"kind" : "IntegerLiteral",
"location" : [ 2, 9, 2, 9 ],
"value" : 2
}
}, {
"kind" : "FuncDef",
"location" : [ 6, 1, 13, 0 ],
"name" : {
"kind" : "Identifier",
"location" : [ 6, 5, 6, 9 ],
"name" : "fun_1"
},
"params" : [ ],
"returnType" : {
"kind" : "ClassType",
"location" : [ 6, 16, 6, 19 ],
"className" : "bool"
},
"declarations" : [ ],
"statements" : [ {
"kind" : "IfStmt",
"location" : [ 7, 5, 13, 0 ],
"condition" : {
"kind" : "BooleanLiteral",
"location" : [ 7, 8, 7, 11 ],
"value" : true
},
"thenBody" : [ {
"kind" : "IfStmt",
"location" : [ 8, 9, 13, 0 ],
"condition" : {
"kind" : "BooleanLiteral",
"location" : [ 8, 12, 8, 15 ],
"value" : true
},
"thenBody" : [ {
"kind" : "ReturnStmt",
"location" : [ 9, 13, 9, 23 ],
"value" : {
"kind" : "BooleanLiteral",
"location" : [ 9, 20, 9, 23 ],
"value" : true
}
} ],
"elseBody" : [ ]
} ],
"elseBody" : [ ]
} ]
} ],
"statements" : [ {
"kind" : "ExprStmt",
"location" : [ 13, 1, 13, 7 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 13, 1, 13, 7 ],
"function" : {
"kind" : "Identifier",
"location" : [ 13, 1, 13, 5 ],
"name" : "fun_1"
},
"args" : [ ]
}
} ],
"errors" : {
"errors" : [ {
"kind" : "CompilerError",
"location" : [ 6, 1, 6, 3 ],
"message" : "Parse error near token DEF: def",
"syntax" : true
} ],
"kind" : "Errors",
"location" : [ 0, 0, 0, 0 ]
}
}