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.
235 lines
5.5 KiB
235 lines
5.5 KiB
{
|
|
"kind" : "Program",
|
|
"location" : [ 1, 1, 8, 9 ],
|
|
"declarations" : [ {
|
|
"kind" : "VarDef",
|
|
"location" : [ 1, 1, 1, 13 ],
|
|
"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" : "str"
|
|
}
|
|
},
|
|
"value" : {
|
|
"kind" : "StringLiteral",
|
|
"location" : [ 1, 9, 1, 13 ],
|
|
"inferredType" : {
|
|
"kind" : "ClassValueType",
|
|
"className" : "str"
|
|
},
|
|
"value" : "abc"
|
|
}
|
|
}, {
|
|
"kind" : "VarDef",
|
|
"location" : [ 2, 1, 2, 10 ],
|
|
"var" : {
|
|
"kind" : "TypedVar",
|
|
"location" : [ 2, 1, 2, 5 ],
|
|
"identifier" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 2, 1, 2, 1 ],
|
|
"name" : "a"
|
|
},
|
|
"type" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 2, 3, 2, 5 ],
|
|
"className" : "str"
|
|
}
|
|
},
|
|
"value" : {
|
|
"kind" : "StringLiteral",
|
|
"location" : [ 2, 9, 2, 10 ],
|
|
"inferredType" : {
|
|
"kind" : "ClassValueType",
|
|
"className" : "str"
|
|
},
|
|
"value" : ""
|
|
}
|
|
}, {
|
|
"kind" : "FuncDef",
|
|
"location" : [ 4, 1, 5, 16 ],
|
|
"name" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 4, 5, 4, 11 ],
|
|
"name" : "str_get"
|
|
},
|
|
"params" : [ {
|
|
"kind" : "TypedVar",
|
|
"location" : [ 4, 13, 4, 17 ],
|
|
"identifier" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 4, 13, 4, 13 ],
|
|
"name" : "s"
|
|
},
|
|
"type" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 4, 15, 4, 17 ],
|
|
"className" : "str"
|
|
}
|
|
}, {
|
|
"kind" : "TypedVar",
|
|
"location" : [ 4, 20, 4, 24 ],
|
|
"identifier" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 4, 20, 4, 20 ],
|
|
"name" : "i"
|
|
},
|
|
"type" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 4, 22, 4, 24 ],
|
|
"className" : "int"
|
|
}
|
|
} ],
|
|
"returnType" : {
|
|
"kind" : "ClassType",
|
|
"location" : [ 4, 30, 4, 32 ],
|
|
"className" : "str"
|
|
},
|
|
"declarations" : [ ],
|
|
"statements" : [ {
|
|
"kind" : "ReturnStmt",
|
|
"location" : [ 5, 5, 5, 15 ],
|
|
"value" : {
|
|
"kind" : "IndexExpr",
|
|
"location" : [ 5, 12, 5, 15 ],
|
|
"inferredType" : {
|
|
"kind" : "ClassValueType",
|
|
"className" : "str"
|
|
},
|
|
"list" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 5, 12, 5, 12 ],
|
|
"inferredType" : {
|
|
"kind" : "ClassValueType",
|
|
"className" : "str"
|
|
},
|
|
"name" : "s"
|
|
},
|
|
"index" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 5, 14, 5, 14 ],
|
|
"inferredType" : {
|
|
"kind" : "ClassValueType",
|
|
"className" : "int"
|
|
},
|
|
"name" : "i"
|
|
}
|
|
}
|
|
} ]
|
|
} ],
|
|
"statements" : [ {
|
|
"kind" : "AssignStmt",
|
|
"location" : [ 7, 1, 7, 18 ],
|
|
"targets" : [ {
|
|
"kind" : "Identifier",
|
|
"location" : [ 7, 1, 7, 1 ],
|
|
"inferredType" : {
|
|
"kind" : "ClassValueType",
|
|
"className" : "str"
|
|
},
|
|
"name" : "a"
|
|
} ],
|
|
"value" : {
|
|
"kind" : "CallExpr",
|
|
"location" : [ 7, 5, 7, 18 ],
|
|
"inferredType" : {
|
|
"kind" : "ClassValueType",
|
|
"className" : "str"
|
|
},
|
|
"function" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 7, 5, 7, 11 ],
|
|
"inferredType" : {
|
|
"kind" : "FuncType",
|
|
"parameters" : [ {
|
|
"kind" : "ClassValueType",
|
|
"className" : "str"
|
|
}, {
|
|
"kind" : "ClassValueType",
|
|
"className" : "int"
|
|
} ],
|
|
"returnType" : {
|
|
"kind" : "ClassValueType",
|
|
"className" : "str"
|
|
}
|
|
},
|
|
"name" : "str_get"
|
|
},
|
|
"args" : [ {
|
|
"kind" : "Identifier",
|
|
"location" : [ 7, 13, 7, 13 ],
|
|
"inferredType" : {
|
|
"kind" : "ClassValueType",
|
|
"className" : "str"
|
|
},
|
|
"name" : "x"
|
|
}, {
|
|
"kind" : "UnaryExpr",
|
|
"location" : [ 7, 16, 7, 17 ],
|
|
"inferredType" : {
|
|
"kind" : "ClassValueType",
|
|
"className" : "int"
|
|
},
|
|
"operator" : "-",
|
|
"operand" : {
|
|
"kind" : "IntegerLiteral",
|
|
"location" : [ 7, 17, 7, 17 ],
|
|
"inferredType" : {
|
|
"kind" : "ClassValueType",
|
|
"className" : "int"
|
|
},
|
|
"value" : 1
|
|
}
|
|
} ]
|
|
}
|
|
}, {
|
|
"kind" : "ExprStmt",
|
|
"location" : [ 8, 1, 8, 8 ],
|
|
"expr" : {
|
|
"kind" : "CallExpr",
|
|
"location" : [ 8, 1, 8, 8 ],
|
|
"inferredType" : {
|
|
"kind" : "ClassValueType",
|
|
"className" : "<None>"
|
|
},
|
|
"function" : {
|
|
"kind" : "Identifier",
|
|
"location" : [ 8, 1, 8, 5 ],
|
|
"inferredType" : {
|
|
"kind" : "FuncType",
|
|
"parameters" : [ {
|
|
"kind" : "ClassValueType",
|
|
"className" : "object"
|
|
} ],
|
|
"returnType" : {
|
|
"kind" : "ClassValueType",
|
|
"className" : "<None>"
|
|
}
|
|
},
|
|
"name" : "print"
|
|
},
|
|
"args" : [ {
|
|
"kind" : "Identifier",
|
|
"location" : [ 8, 7, 8, 7 ],
|
|
"inferredType" : {
|
|
"kind" : "ClassValueType",
|
|
"className" : "str"
|
|
},
|
|
"name" : "a"
|
|
} ]
|
|
}
|
|
} ],
|
|
"errors" : {
|
|
"errors" : [ ],
|
|
"kind" : "Errors",
|
|
"location" : [ 0, 0, 0, 0 ]
|
|
}
|
|
} |