This commit is contained in:
ldXiao
2021-05-16 11:17:01 -04:00
parent b745aab547
commit 4d80343a57
261 changed files with 30055 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
def f() -> int:
print("start f")
g()
print("end f")
return 42
def g() -> object:
print("start g")
h()
print("end g")
def h() -> object:
print("start h")
print("end h")
print(f())
+386
View File
@@ -0,0 +1,386 @@
{
"kind" : "Program",
"location" : [ 1, 1, 17, 11 ],
"declarations" : [ {
"kind" : "FuncDef",
"location" : [ 1, 1, 5, 14 ],
"name" : {
"kind" : "Identifier",
"location" : [ 1, 5, 1, 5 ],
"name" : "f"
},
"params" : [ ],
"returnType" : {
"kind" : "ClassType",
"location" : [ 1, 12, 1, 14 ],
"className" : "int"
},
"declarations" : [ ],
"statements" : [ {
"kind" : "ExprStmt",
"location" : [ 2, 5, 2, 20 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 2, 5, 2, 20 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 2, 5, 2, 9 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "StringLiteral",
"location" : [ 2, 11, 2, 19 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "str"
},
"value" : "start f"
} ]
}
}, {
"kind" : "ExprStmt",
"location" : [ 3, 5, 3, 7 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 3, 5, 3, 7 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "object"
},
"function" : {
"kind" : "Identifier",
"location" : [ 3, 5, 3, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "object"
}
},
"name" : "g"
},
"args" : [ ]
}
}, {
"kind" : "ExprStmt",
"location" : [ 4, 5, 4, 18 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 4, 5, 4, 18 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 4, 5, 4, 9 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "StringLiteral",
"location" : [ 4, 11, 4, 17 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "str"
},
"value" : "end f"
} ]
}
}, {
"kind" : "ReturnStmt",
"location" : [ 5, 5, 5, 13 ],
"value" : {
"kind" : "IntegerLiteral",
"location" : [ 5, 12, 5, 13 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 42
}
} ]
}, {
"kind" : "FuncDef",
"location" : [ 8, 1, 11, 19 ],
"name" : {
"kind" : "Identifier",
"location" : [ 8, 5, 8, 5 ],
"name" : "g"
},
"params" : [ ],
"returnType" : {
"kind" : "ClassType",
"location" : [ 8, 12, 8, 17 ],
"className" : "object"
},
"declarations" : [ ],
"statements" : [ {
"kind" : "ExprStmt",
"location" : [ 9, 5, 9, 20 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 9, 5, 9, 20 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 9, 5, 9, 9 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "StringLiteral",
"location" : [ 9, 11, 9, 19 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "str"
},
"value" : "start g"
} ]
}
}, {
"kind" : "ExprStmt",
"location" : [ 10, 5, 10, 7 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 10, 5, 10, 7 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "object"
},
"function" : {
"kind" : "Identifier",
"location" : [ 10, 5, 10, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "object"
}
},
"name" : "h"
},
"args" : [ ]
}
}, {
"kind" : "ExprStmt",
"location" : [ 11, 5, 11, 18 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 11, 5, 11, 18 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 11, 5, 11, 9 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "StringLiteral",
"location" : [ 11, 11, 11, 17 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "str"
},
"value" : "end g"
} ]
}
} ]
}, {
"kind" : "FuncDef",
"location" : [ 13, 1, 15, 19 ],
"name" : {
"kind" : "Identifier",
"location" : [ 13, 5, 13, 5 ],
"name" : "h"
},
"params" : [ ],
"returnType" : {
"kind" : "ClassType",
"location" : [ 13, 12, 13, 17 ],
"className" : "object"
},
"declarations" : [ ],
"statements" : [ {
"kind" : "ExprStmt",
"location" : [ 14, 5, 14, 20 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 14, 5, 14, 20 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 14, 5, 14, 9 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "StringLiteral",
"location" : [ 14, 11, 14, 19 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "str"
},
"value" : "start h"
} ]
}
}, {
"kind" : "ExprStmt",
"location" : [ 15, 5, 15, 18 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 15, 5, 15, 18 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 15, 5, 15, 9 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "StringLiteral",
"location" : [ 15, 11, 15, 17 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "str"
},
"value" : "end h"
} ]
}
} ]
} ],
"statements" : [ {
"kind" : "ExprStmt",
"location" : [ 17, 1, 17, 10 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 17, 1, 17, 10 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 17, 1, 17, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "CallExpr",
"location" : [ 17, 7, 17, 9 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"function" : {
"kind" : "Identifier",
"location" : [ 17, 7, 17, 7 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "f"
},
"args" : [ ]
} ]
}
} ],
"errors" : {
"errors" : [ ],
"kind" : "Errors",
"location" : [ 0, 0, 0, 0 ]
}
}
@@ -0,0 +1,7 @@
start f
start g
start h
end h
end g
end f
42
+19
View File
@@ -0,0 +1,19 @@
def f(x:int) -> int:
print("start f")
print(x)
g(1, x)
print("end f")
return x
def g(y:int, z:int) -> object:
print("start g")
print(y)
print(z)
h("h")
print("end g")
def h(msg: str) -> object:
print(msg)
print(f(4))
+554
View File
@@ -0,0 +1,554 @@
{
"kind" : "Program",
"location" : [ 1, 1, 19, 12 ],
"declarations" : [ {
"kind" : "FuncDef",
"location" : [ 1, 1, 6, 13 ],
"name" : {
"kind" : "Identifier",
"location" : [ 1, 5, 1, 5 ],
"name" : "f"
},
"params" : [ {
"kind" : "TypedVar",
"location" : [ 1, 7, 1, 11 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 1, 7, 1, 7 ],
"name" : "x"
},
"type" : {
"kind" : "ClassType",
"location" : [ 1, 9, 1, 11 ],
"className" : "int"
}
} ],
"returnType" : {
"kind" : "ClassType",
"location" : [ 1, 17, 1, 19 ],
"className" : "int"
},
"declarations" : [ ],
"statements" : [ {
"kind" : "ExprStmt",
"location" : [ 2, 5, 2, 20 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 2, 5, 2, 20 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 2, 5, 2, 9 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "StringLiteral",
"location" : [ 2, 11, 2, 19 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "str"
},
"value" : "start f"
} ]
}
}, {
"kind" : "ExprStmt",
"location" : [ 3, 5, 3, 12 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 3, 5, 3, 12 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 3, 5, 3, 9 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "Identifier",
"location" : [ 3, 11, 3, 11 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"name" : "x"
} ]
}
}, {
"kind" : "ExprStmt",
"location" : [ 4, 5, 4, 11 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 4, 5, 4, 11 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "object"
},
"function" : {
"kind" : "Identifier",
"location" : [ 4, 5, 4, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "int"
}, {
"kind" : "ClassValueType",
"className" : "int"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "object"
}
},
"name" : "g"
},
"args" : [ {
"kind" : "IntegerLiteral",
"location" : [ 4, 7, 4, 7 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 1
}, {
"kind" : "Identifier",
"location" : [ 4, 10, 4, 10 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"name" : "x"
} ]
}
}, {
"kind" : "ExprStmt",
"location" : [ 5, 5, 5, 18 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 5, 5, 5, 18 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 5, 5, 5, 9 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "StringLiteral",
"location" : [ 5, 11, 5, 17 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "str"
},
"value" : "end f"
} ]
}
}, {
"kind" : "ReturnStmt",
"location" : [ 6, 5, 6, 12 ],
"value" : {
"kind" : "Identifier",
"location" : [ 6, 12, 6, 12 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"name" : "x"
}
} ]
}, {
"kind" : "FuncDef",
"location" : [ 9, 1, 14, 19 ],
"name" : {
"kind" : "Identifier",
"location" : [ 9, 5, 9, 5 ],
"name" : "g"
},
"params" : [ {
"kind" : "TypedVar",
"location" : [ 9, 7, 9, 11 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 9, 7, 9, 7 ],
"name" : "y"
},
"type" : {
"kind" : "ClassType",
"location" : [ 9, 9, 9, 11 ],
"className" : "int"
}
}, {
"kind" : "TypedVar",
"location" : [ 9, 14, 9, 18 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 9, 14, 9, 14 ],
"name" : "z"
},
"type" : {
"kind" : "ClassType",
"location" : [ 9, 16, 9, 18 ],
"className" : "int"
}
} ],
"returnType" : {
"kind" : "ClassType",
"location" : [ 9, 24, 9, 29 ],
"className" : "object"
},
"declarations" : [ ],
"statements" : [ {
"kind" : "ExprStmt",
"location" : [ 10, 5, 10, 20 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 10, 5, 10, 20 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 10, 5, 10, 9 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "StringLiteral",
"location" : [ 10, 11, 10, 19 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "str"
},
"value" : "start g"
} ]
}
}, {
"kind" : "ExprStmt",
"location" : [ 11, 5, 11, 12 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 11, 5, 11, 12 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 11, 5, 11, 9 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "Identifier",
"location" : [ 11, 11, 11, 11 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"name" : "y"
} ]
}
}, {
"kind" : "ExprStmt",
"location" : [ 12, 5, 12, 12 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 12, 5, 12, 12 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 12, 5, 12, 9 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "Identifier",
"location" : [ 12, 11, 12, 11 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"name" : "z"
} ]
}
}, {
"kind" : "ExprStmt",
"location" : [ 13, 5, 13, 10 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 13, 5, 13, 10 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "object"
},
"function" : {
"kind" : "Identifier",
"location" : [ 13, 5, 13, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "str"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "object"
}
},
"name" : "h"
},
"args" : [ {
"kind" : "StringLiteral",
"location" : [ 13, 7, 13, 9 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "str"
},
"value" : "h"
} ]
}
}, {
"kind" : "ExprStmt",
"location" : [ 14, 5, 14, 18 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 14, 5, 14, 18 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 14, 5, 14, 9 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "StringLiteral",
"location" : [ 14, 11, 14, 17 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "str"
},
"value" : "end g"
} ]
}
} ]
}, {
"kind" : "FuncDef",
"location" : [ 16, 1, 17, 15 ],
"name" : {
"kind" : "Identifier",
"location" : [ 16, 5, 16, 5 ],
"name" : "h"
},
"params" : [ {
"kind" : "TypedVar",
"location" : [ 16, 7, 16, 14 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 16, 7, 16, 9 ],
"name" : "msg"
},
"type" : {
"kind" : "ClassType",
"location" : [ 16, 12, 16, 14 ],
"className" : "str"
}
} ],
"returnType" : {
"kind" : "ClassType",
"location" : [ 16, 20, 16, 25 ],
"className" : "object"
},
"declarations" : [ ],
"statements" : [ {
"kind" : "ExprStmt",
"location" : [ 17, 5, 17, 14 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 17, 5, 17, 14 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 17, 5, 17, 9 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "Identifier",
"location" : [ 17, 11, 17, 13 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "str"
},
"name" : "msg"
} ]
}
} ]
} ],
"statements" : [ {
"kind" : "ExprStmt",
"location" : [ 19, 1, 19, 11 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 19, 1, 19, 11 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 19, 1, 19, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "CallExpr",
"location" : [ 19, 7, 19, 10 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"function" : {
"kind" : "Identifier",
"location" : [ 19, 7, 19, 7 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "int"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "f"
},
"args" : [ {
"kind" : "IntegerLiteral",
"location" : [ 19, 9, 19, 9 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 4
} ]
} ]
}
} ],
"errors" : {
"errors" : [ ],
"kind" : "Errors",
"location" : [ 0, 0, 0, 0 ]
}
}
@@ -0,0 +1,9 @@
start f
4
start g
1
4
h
end g
end f
4
+1
View File
@@ -0,0 +1 @@
print(42 // 0)
@@ -0,0 +1,65 @@
{
"kind" : "Program",
"location" : [ 1, 1, 1, 15 ],
"declarations" : [ ],
"statements" : [ {
"kind" : "ExprStmt",
"location" : [ 1, 1, 1, 14 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 1, 1, 1, 14 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 1, 1, 1, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "BinaryExpr",
"location" : [ 1, 7, 1, 13 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"left" : {
"kind" : "IntegerLiteral",
"location" : [ 1, 7, 1, 8 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 42
},
"operator" : "//",
"right" : {
"kind" : "IntegerLiteral",
"location" : [ 1, 13, 1, 13 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 0
}
} ]
}
} ],
"errors" : {
"errors" : [ ],
"kind" : "Errors",
"location" : [ 0, 0, 0, 0 ]
}
}
@@ -0,0 +1,2 @@
Division by zero
Exited with error code 2
+1
View File
@@ -0,0 +1 @@
print(None)
@@ -0,0 +1,46 @@
{
"kind" : "Program",
"location" : [ 1, 1, 1, 12 ],
"declarations" : [ ],
"statements" : [ {
"kind" : "ExprStmt",
"location" : [ 1, 1, 1, 11 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 1, 1, 1, 11 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 1, 1, 1, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "NoneLiteral",
"location" : [ 1, 7, 1, 10 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
} ]
}
} ],
"errors" : {
"errors" : [ ],
"kind" : "Errors",
"location" : [ 0, 0, 0, 0 ]
}
}
@@ -0,0 +1,2 @@
Invalid argument
Exited with error code 1
+1
View File
@@ -0,0 +1 @@
print(42 % 0)
@@ -0,0 +1,65 @@
{
"kind" : "Program",
"location" : [ 1, 1, 1, 14 ],
"declarations" : [ ],
"statements" : [ {
"kind" : "ExprStmt",
"location" : [ 1, 1, 1, 13 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 1, 1, 1, 13 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 1, 1, 1, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "BinaryExpr",
"location" : [ 1, 7, 1, 12 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"left" : {
"kind" : "IntegerLiteral",
"location" : [ 1, 7, 1, 8 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 42
},
"operator" : "%",
"right" : {
"kind" : "IntegerLiteral",
"location" : [ 1, 12, 1, 12 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 0
}
} ]
}
} ],
"errors" : {
"errors" : [ ],
"kind" : "Errors",
"location" : [ 0, 0, 0, 0 ]
}
}
@@ -0,0 +1,2 @@
Division by zero
Exited with error code 2
+2
View File
@@ -0,0 +1,2 @@
print(3 if True else 4)
print(3 if False else 4)
+135
View File
@@ -0,0 +1,135 @@
{
"kind" : "Program",
"location" : [ 1, 1, 2, 25 ],
"declarations" : [ ],
"statements" : [ {
"kind" : "ExprStmt",
"location" : [ 1, 1, 1, 23 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 1, 1, 1, 23 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 1, 1, 1, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "IfExpr",
"location" : [ 1, 7, 1, 22 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"condition" : {
"kind" : "BooleanLiteral",
"location" : [ 1, 12, 1, 15 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "bool"
},
"value" : true
},
"thenExpr" : {
"kind" : "IntegerLiteral",
"location" : [ 1, 7, 1, 7 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 3
},
"elseExpr" : {
"kind" : "IntegerLiteral",
"location" : [ 1, 22, 1, 22 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 4
}
} ]
}
}, {
"kind" : "ExprStmt",
"location" : [ 2, 1, 2, 24 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 2, 1, 2, 24 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 2, 1, 2, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "IfExpr",
"location" : [ 2, 7, 2, 23 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"condition" : {
"kind" : "BooleanLiteral",
"location" : [ 2, 12, 2, 16 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "bool"
},
"value" : false
},
"thenExpr" : {
"kind" : "IntegerLiteral",
"location" : [ 2, 7, 2, 7 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 3
},
"elseExpr" : {
"kind" : "IntegerLiteral",
"location" : [ 2, 23, 2, 23 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 4
}
} ]
}
} ],
"errors" : {
"errors" : [ ],
"kind" : "Errors",
"location" : [ 0, 0, 0, 0 ]
}
}
@@ -0,0 +1,2 @@
3
4
+2
View File
@@ -0,0 +1,2 @@
x:int = 42
print(x)
+73
View File
@@ -0,0 +1,73 @@
{
"kind" : "Program",
"location" : [ 1, 1, 2, 9 ],
"declarations" : [ {
"kind" : "VarDef",
"location" : [ 1, 1, 1, 10 ],
"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, 10 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 42
}
} ],
"statements" : [ {
"kind" : "ExprStmt",
"location" : [ 2, 1, 2, 8 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 2, 1, 2, 8 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 2, 1, 2, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "Identifier",
"location" : [ 2, 7, 2, 7 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"name" : "x"
} ]
}
} ],
"errors" : {
"errors" : [ ],
"kind" : "Errors",
"location" : [ 0, 0, 0, 0 ]
}
}
@@ -0,0 +1 @@
42
+5
View File
@@ -0,0 +1,5 @@
def f() -> int:
x:int = 1
return x
print(f())
+114
View File
@@ -0,0 +1,114 @@
{
"kind" : "Program",
"location" : [ 1, 1, 5, 11 ],
"declarations" : [ {
"kind" : "FuncDef",
"location" : [ 1, 1, 3, 11 ],
"name" : {
"kind" : "Identifier",
"location" : [ 1, 5, 1, 5 ],
"name" : "f"
},
"params" : [ ],
"returnType" : {
"kind" : "ClassType",
"location" : [ 1, 12, 1, 14 ],
"className" : "int"
},
"declarations" : [ {
"kind" : "VarDef",
"location" : [ 2, 3, 2, 11 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 2, 3, 2, 7 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 2, 3, 2, 3 ],
"name" : "x"
},
"type" : {
"kind" : "ClassType",
"location" : [ 2, 5, 2, 7 ],
"className" : "int"
}
},
"value" : {
"kind" : "IntegerLiteral",
"location" : [ 2, 11, 2, 11 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 1
}
} ],
"statements" : [ {
"kind" : "ReturnStmt",
"location" : [ 3, 3, 3, 10 ],
"value" : {
"kind" : "Identifier",
"location" : [ 3, 10, 3, 10 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"name" : "x"
}
} ]
} ],
"statements" : [ {
"kind" : "ExprStmt",
"location" : [ 5, 1, 5, 10 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 5, 1, 5, 10 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 5, 1, 5, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "CallExpr",
"location" : [ 5, 7, 5, 9 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"function" : {
"kind" : "Identifier",
"location" : [ 5, 7, 5, 7 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "f"
},
"args" : [ ]
} ]
}
} ],
"errors" : {
"errors" : [ ],
"kind" : "Errors",
"location" : [ 0, 0, 0, 0 ]
}
}
@@ -0,0 +1 @@
1
+8
View File
@@ -0,0 +1,8 @@
# Test of 'input' function.
s: str = ""
s = input()
while len(s) > 0:
print(s)
s = input()
+4
View File
@@ -0,0 +1,4 @@
First line.
Next line is blank.
Last line.
+196
View File
@@ -0,0 +1,196 @@
{
"kind" : "Program",
"location" : [ 3, 1, 9, 1 ],
"declarations" : [ {
"kind" : "VarDef",
"location" : [ 3, 1, 3, 11 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 3, 1, 3, 6 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 3, 1, 3, 1 ],
"name" : "s"
},
"type" : {
"kind" : "ClassType",
"location" : [ 3, 4, 3, 6 ],
"className" : "str"
}
},
"value" : {
"kind" : "StringLiteral",
"location" : [ 3, 10, 3, 11 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "str"
},
"value" : ""
}
} ],
"statements" : [ {
"kind" : "AssignStmt",
"location" : [ 5, 1, 5, 11 ],
"targets" : [ {
"kind" : "Identifier",
"location" : [ 5, 1, 5, 1 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "str"
},
"name" : "s"
} ],
"value" : {
"kind" : "CallExpr",
"location" : [ 5, 5, 5, 11 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "str"
},
"function" : {
"kind" : "Identifier",
"location" : [ 5, 5, 5, 9 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "str"
}
},
"name" : "input"
},
"args" : [ ]
}
}, {
"kind" : "WhileStmt",
"location" : [ 6, 1, 9, 1 ],
"condition" : {
"kind" : "BinaryExpr",
"location" : [ 6, 7, 6, 16 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "bool"
},
"left" : {
"kind" : "CallExpr",
"location" : [ 6, 7, 6, 12 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"function" : {
"kind" : "Identifier",
"location" : [ 6, 7, 6, 9 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "len"
},
"args" : [ {
"kind" : "Identifier",
"location" : [ 6, 11, 6, 11 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "str"
},
"name" : "s"
} ]
},
"operator" : ">",
"right" : {
"kind" : "IntegerLiteral",
"location" : [ 6, 16, 6, 16 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 0
}
},
"body" : [ {
"kind" : "ExprStmt",
"location" : [ 7, 5, 7, 12 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 7, 5, 7, 12 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 7, 5, 7, 9 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "Identifier",
"location" : [ 7, 11, 7, 11 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "str"
},
"name" : "s"
} ]
}
}, {
"kind" : "AssignStmt",
"location" : [ 8, 5, 8, 15 ],
"targets" : [ {
"kind" : "Identifier",
"location" : [ 8, 5, 8, 5 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "str"
},
"name" : "s"
} ],
"value" : {
"kind" : "CallExpr",
"location" : [ 8, 9, 8, 15 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "str"
},
"function" : {
"kind" : "Identifier",
"location" : [ 8, 9, 8, 13 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "str"
}
},
"name" : "input"
},
"args" : [ ]
}
} ]
} ],
"errors" : {
"errors" : [ ],
"kind" : "Errors",
"location" : [ 0, 0, 0, 0 ]
}
}
+4
View File
@@ -0,0 +1,4 @@
First line.
Next line is blank.
Last line.
@@ -0,0 +1,8 @@
First line.
Next line is blank.
Last line.
+4
View File
@@ -0,0 +1,4 @@
First line.
Next line is blank.
Last line.
+3
View File
@@ -0,0 +1,3 @@
x:[int] = None
print(len(x))
+103
View File
@@ -0,0 +1,103 @@
{
"kind" : "Program",
"location" : [ 1, 1, 3, 14 ],
"declarations" : [ {
"kind" : "VarDef",
"location" : [ 1, 1, 1, 14 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 1, 1, 1, 7 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 1, 1, 1, 1 ],
"name" : "x"
},
"type" : {
"kind" : "ListType",
"location" : [ 1, 3, 1, 7 ],
"elementType" : {
"kind" : "ClassType",
"location" : [ 1, 4, 1, 6 ],
"className" : "int"
}
}
},
"value" : {
"kind" : "NoneLiteral",
"location" : [ 1, 11, 1, 14 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
}
} ],
"statements" : [ {
"kind" : "ExprStmt",
"location" : [ 3, 1, 3, 13 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 3, 1, 3, 13 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 3, 1, 3, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "CallExpr",
"location" : [ 3, 7, 3, 12 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"function" : {
"kind" : "Identifier",
"location" : [ 3, 7, 3, 9 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "len"
},
"args" : [ {
"kind" : "Identifier",
"location" : [ 3, 11, 3, 11 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
} ]
} ]
}
} ],
"errors" : {
"errors" : [ ],
"kind" : "Errors",
"location" : [ 0, 0, 0, 0 ]
}
}
@@ -0,0 +1,2 @@
Invalid argument
Exited with error code 1
+3
View File
@@ -0,0 +1,3 @@
x:int = 1
print(len(x))
+97
View File
@@ -0,0 +1,97 @@
{
"kind" : "Program",
"location" : [ 1, 1, 3, 14 ],
"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 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 1
}
} ],
"statements" : [ {
"kind" : "ExprStmt",
"location" : [ 3, 1, 3, 13 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 3, 1, 3, 13 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 3, 1, 3, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "CallExpr",
"location" : [ 3, 7, 3, 12 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"function" : {
"kind" : "Identifier",
"location" : [ 3, 7, 3, 9 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "len"
},
"args" : [ {
"kind" : "Identifier",
"location" : [ 3, 11, 3, 11 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"name" : "x"
} ]
} ]
}
} ],
"errors" : {
"errors" : [ ],
"kind" : "Errors",
"location" : [ 0, 0, 0, 0 ]
}
}
@@ -0,0 +1,2 @@
Invalid argument
Exited with error code 1
+12
View File
@@ -0,0 +1,12 @@
def concat(x:[int], y:[int]) -> [int]:
return x + y
z:[int] = None
i:int = 0
z = concat([1,2,3], [4,5,6])
while i < len(z):
print(z[i])
i = i + 1
+437
View File
@@ -0,0 +1,437 @@
{
"kind" : "Program",
"location" : [ 1, 1, 13, 1 ],
"declarations" : [ {
"kind" : "FuncDef",
"location" : [ 1, 1, 2, 17 ],
"name" : {
"kind" : "Identifier",
"location" : [ 1, 5, 1, 10 ],
"name" : "concat"
},
"params" : [ {
"kind" : "TypedVar",
"location" : [ 1, 12, 1, 18 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 1, 12, 1, 12 ],
"name" : "x"
},
"type" : {
"kind" : "ListType",
"location" : [ 1, 14, 1, 18 ],
"elementType" : {
"kind" : "ClassType",
"location" : [ 1, 15, 1, 17 ],
"className" : "int"
}
}
}, {
"kind" : "TypedVar",
"location" : [ 1, 21, 1, 27 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 1, 21, 1, 21 ],
"name" : "y"
},
"type" : {
"kind" : "ListType",
"location" : [ 1, 23, 1, 27 ],
"elementType" : {
"kind" : "ClassType",
"location" : [ 1, 24, 1, 26 ],
"className" : "int"
}
}
} ],
"returnType" : {
"kind" : "ListType",
"location" : [ 1, 33, 1, 37 ],
"elementType" : {
"kind" : "ClassType",
"location" : [ 1, 34, 1, 36 ],
"className" : "int"
}
},
"declarations" : [ ],
"statements" : [ {
"kind" : "ReturnStmt",
"location" : [ 2, 5, 2, 16 ],
"value" : {
"kind" : "BinaryExpr",
"location" : [ 2, 12, 2, 16 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"left" : {
"kind" : "Identifier",
"location" : [ 2, 12, 2, 12 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
},
"operator" : "+",
"right" : {
"kind" : "Identifier",
"location" : [ 2, 16, 2, 16 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "y"
}
}
} ]
}, {
"kind" : "VarDef",
"location" : [ 4, 1, 4, 14 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 4, 1, 4, 7 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 4, 1, 4, 1 ],
"name" : "z"
},
"type" : {
"kind" : "ListType",
"location" : [ 4, 3, 4, 7 ],
"elementType" : {
"kind" : "ClassType",
"location" : [ 4, 4, 4, 6 ],
"className" : "int"
}
}
},
"value" : {
"kind" : "NoneLiteral",
"location" : [ 4, 11, 4, 14 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
}
}, {
"kind" : "VarDef",
"location" : [ 5, 1, 5, 9 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 5, 1, 5, 5 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 5, 1, 5, 1 ],
"name" : "i"
},
"type" : {
"kind" : "ClassType",
"location" : [ 5, 3, 5, 5 ],
"className" : "int"
}
},
"value" : {
"kind" : "IntegerLiteral",
"location" : [ 5, 9, 5, 9 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 0
}
} ],
"statements" : [ {
"kind" : "AssignStmt",
"location" : [ 7, 1, 7, 28 ],
"targets" : [ {
"kind" : "Identifier",
"location" : [ 7, 1, 7, 1 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "z"
} ],
"value" : {
"kind" : "CallExpr",
"location" : [ 7, 5, 7, 28 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"function" : {
"kind" : "Identifier",
"location" : [ 7, 5, 7, 10 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
}, {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
} ],
"returnType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
}
},
"name" : "concat"
},
"args" : [ {
"kind" : "ListExpr",
"location" : [ 7, 12, 7, 18 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"elements" : [ {
"kind" : "IntegerLiteral",
"location" : [ 7, 13, 7, 13 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 1
}, {
"kind" : "IntegerLiteral",
"location" : [ 7, 15, 7, 15 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 2
}, {
"kind" : "IntegerLiteral",
"location" : [ 7, 17, 7, 17 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 3
} ]
}, {
"kind" : "ListExpr",
"location" : [ 7, 21, 7, 27 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"elements" : [ {
"kind" : "IntegerLiteral",
"location" : [ 7, 22, 7, 22 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 4
}, {
"kind" : "IntegerLiteral",
"location" : [ 7, 24, 7, 24 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 5
}, {
"kind" : "IntegerLiteral",
"location" : [ 7, 26, 7, 26 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 6
} ]
} ]
}
}, {
"kind" : "WhileStmt",
"location" : [ 9, 1, 13, 1 ],
"condition" : {
"kind" : "BinaryExpr",
"location" : [ 9, 7, 9, 16 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "bool"
},
"left" : {
"kind" : "Identifier",
"location" : [ 9, 7, 9, 7 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"name" : "i"
},
"operator" : "<",
"right" : {
"kind" : "CallExpr",
"location" : [ 9, 11, 9, 16 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"function" : {
"kind" : "Identifier",
"location" : [ 9, 11, 9, 13 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "len"
},
"args" : [ {
"kind" : "Identifier",
"location" : [ 9, 15, 9, 15 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "z"
} ]
}
},
"body" : [ {
"kind" : "ExprStmt",
"location" : [ 10, 5, 10, 15 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 10, 5, 10, 15 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 10, 5, 10, 9 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "IndexExpr",
"location" : [ 10, 11, 10, 14 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"list" : {
"kind" : "Identifier",
"location" : [ 10, 11, 10, 11 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "z"
},
"index" : {
"kind" : "Identifier",
"location" : [ 10, 13, 10, 13 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"name" : "i"
}
} ]
}
}, {
"kind" : "AssignStmt",
"location" : [ 11, 5, 11, 13 ],
"targets" : [ {
"kind" : "Identifier",
"location" : [ 11, 5, 11, 5 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"name" : "i"
} ],
"value" : {
"kind" : "BinaryExpr",
"location" : [ 11, 9, 11, 13 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"left" : {
"kind" : "Identifier",
"location" : [ 11, 9, 11, 9 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"name" : "i"
},
"operator" : "+",
"right" : {
"kind" : "IntegerLiteral",
"location" : [ 11, 13, 11, 13 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 1
}
}
} ]
} ],
"errors" : {
"errors" : [ ],
"kind" : "Errors",
"location" : [ 0, 0, 0, 0 ]
}
}
@@ -0,0 +1,6 @@
1
2
3
4
5
6
+8
View File
@@ -0,0 +1,8 @@
z:[int] = None
i:int = 0
z = [1,2,3] + [4,5,6] + [7,8,9]
while i < len(z):
print(z[i])
i = i + 1
+366
View File
@@ -0,0 +1,366 @@
{
"kind" : "Program",
"location" : [ 1, 1, 9, 1 ],
"declarations" : [ {
"kind" : "VarDef",
"location" : [ 1, 1, 1, 14 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 1, 1, 1, 7 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 1, 1, 1, 1 ],
"name" : "z"
},
"type" : {
"kind" : "ListType",
"location" : [ 1, 3, 1, 7 ],
"elementType" : {
"kind" : "ClassType",
"location" : [ 1, 4, 1, 6 ],
"className" : "int"
}
}
},
"value" : {
"kind" : "NoneLiteral",
"location" : [ 1, 11, 1, 14 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
}
}, {
"kind" : "VarDef",
"location" : [ 2, 1, 2, 9 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 2, 1, 2, 5 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 2, 1, 2, 1 ],
"name" : "i"
},
"type" : {
"kind" : "ClassType",
"location" : [ 2, 3, 2, 5 ],
"className" : "int"
}
},
"value" : {
"kind" : "IntegerLiteral",
"location" : [ 2, 9, 2, 9 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 0
}
} ],
"statements" : [ {
"kind" : "AssignStmt",
"location" : [ 4, 1, 4, 31 ],
"targets" : [ {
"kind" : "Identifier",
"location" : [ 4, 1, 4, 1 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "z"
} ],
"value" : {
"kind" : "BinaryExpr",
"location" : [ 4, 5, 4, 31 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"left" : {
"kind" : "BinaryExpr",
"location" : [ 4, 5, 4, 21 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"left" : {
"kind" : "ListExpr",
"location" : [ 4, 5, 4, 11 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"elements" : [ {
"kind" : "IntegerLiteral",
"location" : [ 4, 6, 4, 6 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 1
}, {
"kind" : "IntegerLiteral",
"location" : [ 4, 8, 4, 8 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 2
}, {
"kind" : "IntegerLiteral",
"location" : [ 4, 10, 4, 10 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 3
} ]
},
"operator" : "+",
"right" : {
"kind" : "ListExpr",
"location" : [ 4, 15, 4, 21 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"elements" : [ {
"kind" : "IntegerLiteral",
"location" : [ 4, 16, 4, 16 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 4
}, {
"kind" : "IntegerLiteral",
"location" : [ 4, 18, 4, 18 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 5
}, {
"kind" : "IntegerLiteral",
"location" : [ 4, 20, 4, 20 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 6
} ]
}
},
"operator" : "+",
"right" : {
"kind" : "ListExpr",
"location" : [ 4, 25, 4, 31 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"elements" : [ {
"kind" : "IntegerLiteral",
"location" : [ 4, 26, 4, 26 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 7
}, {
"kind" : "IntegerLiteral",
"location" : [ 4, 28, 4, 28 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 8
}, {
"kind" : "IntegerLiteral",
"location" : [ 4, 30, 4, 30 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 9
} ]
}
}
}, {
"kind" : "WhileStmt",
"location" : [ 6, 1, 9, 1 ],
"condition" : {
"kind" : "BinaryExpr",
"location" : [ 6, 7, 6, 16 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "bool"
},
"left" : {
"kind" : "Identifier",
"location" : [ 6, 7, 6, 7 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"name" : "i"
},
"operator" : "<",
"right" : {
"kind" : "CallExpr",
"location" : [ 6, 11, 6, 16 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"function" : {
"kind" : "Identifier",
"location" : [ 6, 11, 6, 13 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "len"
},
"args" : [ {
"kind" : "Identifier",
"location" : [ 6, 15, 6, 15 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "z"
} ]
}
},
"body" : [ {
"kind" : "ExprStmt",
"location" : [ 7, 5, 7, 15 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 7, 5, 7, 15 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 7, 5, 7, 9 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "IndexExpr",
"location" : [ 7, 11, 7, 14 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"list" : {
"kind" : "Identifier",
"location" : [ 7, 11, 7, 11 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "z"
},
"index" : {
"kind" : "Identifier",
"location" : [ 7, 13, 7, 13 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"name" : "i"
}
} ]
}
}, {
"kind" : "AssignStmt",
"location" : [ 8, 5, 8, 13 ],
"targets" : [ {
"kind" : "Identifier",
"location" : [ 8, 5, 8, 5 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"name" : "i"
} ],
"value" : {
"kind" : "BinaryExpr",
"location" : [ 8, 9, 8, 13 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"left" : {
"kind" : "Identifier",
"location" : [ 8, 9, 8, 9 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"name" : "i"
},
"operator" : "+",
"right" : {
"kind" : "IntegerLiteral",
"location" : [ 8, 13, 8, 13 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 1
}
}
} ]
} ],
"errors" : {
"errors" : [ ],
"kind" : "Errors",
"location" : [ 0, 0, 0, 0 ]
}
}
@@ -0,0 +1,9 @@
1
2
3
4
5
6
7
8
9
+4
View File
@@ -0,0 +1,4 @@
x:[int] = None
y:[int] = None
print(len(x+y))
@@ -0,0 +1,156 @@
{
"kind" : "Program",
"location" : [ 1, 1, 4, 16 ],
"declarations" : [ {
"kind" : "VarDef",
"location" : [ 1, 1, 1, 14 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 1, 1, 1, 7 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 1, 1, 1, 1 ],
"name" : "x"
},
"type" : {
"kind" : "ListType",
"location" : [ 1, 3, 1, 7 ],
"elementType" : {
"kind" : "ClassType",
"location" : [ 1, 4, 1, 6 ],
"className" : "int"
}
}
},
"value" : {
"kind" : "NoneLiteral",
"location" : [ 1, 11, 1, 14 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
}
}, {
"kind" : "VarDef",
"location" : [ 2, 1, 2, 14 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 2, 1, 2, 7 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 2, 1, 2, 1 ],
"name" : "y"
},
"type" : {
"kind" : "ListType",
"location" : [ 2, 3, 2, 7 ],
"elementType" : {
"kind" : "ClassType",
"location" : [ 2, 4, 2, 6 ],
"className" : "int"
}
}
},
"value" : {
"kind" : "NoneLiteral",
"location" : [ 2, 11, 2, 14 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
}
} ],
"statements" : [ {
"kind" : "ExprStmt",
"location" : [ 4, 1, 4, 15 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 4, 1, 4, 15 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 4, 1, 4, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "CallExpr",
"location" : [ 4, 7, 4, 14 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"function" : {
"kind" : "Identifier",
"location" : [ 4, 7, 4, 9 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "len"
},
"args" : [ {
"kind" : "BinaryExpr",
"location" : [ 4, 11, 4, 13 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"left" : {
"kind" : "Identifier",
"location" : [ 4, 11, 4, 11 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
},
"operator" : "+",
"right" : {
"kind" : "Identifier",
"location" : [ 4, 13, 4, 13 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "y"
}
} ]
} ]
}
} ],
"errors" : {
"errors" : [ ],
"kind" : "Errors",
"location" : [ 0, 0, 0, 0 ]
}
}
@@ -0,0 +1,2 @@
Operation on None
Exited with error code 4
+6
View File
@@ -0,0 +1,6 @@
x:[int] = None
x = [1, 2, 3]
print(x[0])
print(x[1])
print(x[2])
@@ -0,0 +1,259 @@
{
"kind" : "Program",
"location" : [ 1, 1, 6, 12 ],
"declarations" : [ {
"kind" : "VarDef",
"location" : [ 1, 1, 1, 14 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 1, 1, 1, 7 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 1, 1, 1, 1 ],
"name" : "x"
},
"type" : {
"kind" : "ListType",
"location" : [ 1, 3, 1, 7 ],
"elementType" : {
"kind" : "ClassType",
"location" : [ 1, 4, 1, 6 ],
"className" : "int"
}
}
},
"value" : {
"kind" : "NoneLiteral",
"location" : [ 1, 11, 1, 14 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
}
} ],
"statements" : [ {
"kind" : "AssignStmt",
"location" : [ 3, 1, 3, 13 ],
"targets" : [ {
"kind" : "Identifier",
"location" : [ 3, 1, 3, 1 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
} ],
"value" : {
"kind" : "ListExpr",
"location" : [ 3, 5, 3, 13 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"elements" : [ {
"kind" : "IntegerLiteral",
"location" : [ 3, 6, 3, 6 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 1
}, {
"kind" : "IntegerLiteral",
"location" : [ 3, 9, 3, 9 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 2
}, {
"kind" : "IntegerLiteral",
"location" : [ 3, 12, 3, 12 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 3
} ]
}
}, {
"kind" : "ExprStmt",
"location" : [ 4, 1, 4, 11 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 4, 1, 4, 11 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 4, 1, 4, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "IndexExpr",
"location" : [ 4, 7, 4, 10 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"list" : {
"kind" : "Identifier",
"location" : [ 4, 7, 4, 7 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
},
"index" : {
"kind" : "IntegerLiteral",
"location" : [ 4, 9, 4, 9 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 0
}
} ]
}
}, {
"kind" : "ExprStmt",
"location" : [ 5, 1, 5, 11 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 5, 1, 5, 11 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 5, 1, 5, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "IndexExpr",
"location" : [ 5, 7, 5, 10 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"list" : {
"kind" : "Identifier",
"location" : [ 5, 7, 5, 7 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
},
"index" : {
"kind" : "IntegerLiteral",
"location" : [ 5, 9, 5, 9 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 1
}
} ]
}
}, {
"kind" : "ExprStmt",
"location" : [ 6, 1, 6, 11 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 6, 1, 6, 11 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 6, 1, 6, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "IndexExpr",
"location" : [ 6, 7, 6, 10 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"list" : {
"kind" : "Identifier",
"location" : [ 6, 7, 6, 7 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
},
"index" : {
"kind" : "IntegerLiteral",
"location" : [ 6, 9, 6, 9 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 2
}
} ]
}
} ],
"errors" : {
"errors" : [ ],
"kind" : "Errors",
"location" : [ 0, 0, 0, 0 ]
}
}
@@ -0,0 +1,3 @@
1
2
3
@@ -0,0 +1,11 @@
next:int = 0
def next_int() -> int:
global next
next = next + 1
return next
def make_list() -> [int]:
return [next_int(), next_int(), next_int()]
print(make_list()[next_int() - 3])
@@ -0,0 +1,313 @@
{
"kind" : "Program",
"location" : [ 1, 1, 11, 35 ],
"declarations" : [ {
"kind" : "VarDef",
"location" : [ 1, 1, 1, 12 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 1, 1, 1, 8 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 1, 1, 1, 4 ],
"name" : "next"
},
"type" : {
"kind" : "ClassType",
"location" : [ 1, 6, 1, 8 ],
"className" : "int"
}
},
"value" : {
"kind" : "IntegerLiteral",
"location" : [ 1, 12, 1, 12 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 0
}
}, {
"kind" : "FuncDef",
"location" : [ 3, 1, 6, 16 ],
"name" : {
"kind" : "Identifier",
"location" : [ 3, 5, 3, 12 ],
"name" : "next_int"
},
"params" : [ ],
"returnType" : {
"kind" : "ClassType",
"location" : [ 3, 19, 3, 21 ],
"className" : "int"
},
"declarations" : [ {
"kind" : "GlobalDecl",
"location" : [ 4, 5, 4, 15 ],
"variable" : {
"kind" : "Identifier",
"location" : [ 4, 12, 4, 15 ],
"name" : "next"
}
} ],
"statements" : [ {
"kind" : "AssignStmt",
"location" : [ 5, 5, 5, 19 ],
"targets" : [ {
"kind" : "Identifier",
"location" : [ 5, 5, 5, 8 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"name" : "next"
} ],
"value" : {
"kind" : "BinaryExpr",
"location" : [ 5, 12, 5, 19 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"left" : {
"kind" : "Identifier",
"location" : [ 5, 12, 5, 15 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"name" : "next"
},
"operator" : "+",
"right" : {
"kind" : "IntegerLiteral",
"location" : [ 5, 19, 5, 19 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 1
}
}
}, {
"kind" : "ReturnStmt",
"location" : [ 6, 5, 6, 15 ],
"value" : {
"kind" : "Identifier",
"location" : [ 6, 12, 6, 15 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"name" : "next"
}
} ]
}, {
"kind" : "FuncDef",
"location" : [ 8, 1, 9, 48 ],
"name" : {
"kind" : "Identifier",
"location" : [ 8, 5, 8, 13 ],
"name" : "make_list"
},
"params" : [ ],
"returnType" : {
"kind" : "ListType",
"location" : [ 8, 20, 8, 24 ],
"elementType" : {
"kind" : "ClassType",
"location" : [ 8, 21, 8, 23 ],
"className" : "int"
}
},
"declarations" : [ ],
"statements" : [ {
"kind" : "ReturnStmt",
"location" : [ 9, 5, 9, 47 ],
"value" : {
"kind" : "ListExpr",
"location" : [ 9, 12, 9, 47 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"elements" : [ {
"kind" : "CallExpr",
"location" : [ 9, 13, 9, 22 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"function" : {
"kind" : "Identifier",
"location" : [ 9, 13, 9, 20 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "next_int"
},
"args" : [ ]
}, {
"kind" : "CallExpr",
"location" : [ 9, 25, 9, 34 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"function" : {
"kind" : "Identifier",
"location" : [ 9, 25, 9, 32 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "next_int"
},
"args" : [ ]
}, {
"kind" : "CallExpr",
"location" : [ 9, 37, 9, 46 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"function" : {
"kind" : "Identifier",
"location" : [ 9, 37, 9, 44 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "next_int"
},
"args" : [ ]
} ]
}
} ]
} ],
"statements" : [ {
"kind" : "ExprStmt",
"location" : [ 11, 1, 11, 34 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 11, 1, 11, 34 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 11, 1, 11, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "IndexExpr",
"location" : [ 11, 7, 11, 33 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"list" : {
"kind" : "CallExpr",
"location" : [ 11, 7, 11, 17 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"function" : {
"kind" : "Identifier",
"location" : [ 11, 7, 11, 15 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ ],
"returnType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
}
},
"name" : "make_list"
},
"args" : [ ]
},
"index" : {
"kind" : "BinaryExpr",
"location" : [ 11, 19, 11, 32 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"left" : {
"kind" : "CallExpr",
"location" : [ 11, 19, 11, 28 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"function" : {
"kind" : "Identifier",
"location" : [ 11, 19, 11, 26 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "next_int"
},
"args" : [ ]
},
"operator" : "-",
"right" : {
"kind" : "IntegerLiteral",
"location" : [ 11, 32, 11, 32 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 3
}
}
} ]
}
} ],
"errors" : {
"errors" : [ ],
"kind" : "Errors",
"location" : [ 0, 0, 0, 0 ]
}
}
@@ -0,0 +1 @@
2
+3
View File
@@ -0,0 +1,3 @@
x:[int] = None
print(x[0])
@@ -0,0 +1,96 @@
{
"kind" : "Program",
"location" : [ 1, 1, 3, 12 ],
"declarations" : [ {
"kind" : "VarDef",
"location" : [ 1, 1, 1, 14 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 1, 1, 1, 7 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 1, 1, 1, 1 ],
"name" : "x"
},
"type" : {
"kind" : "ListType",
"location" : [ 1, 3, 1, 7 ],
"elementType" : {
"kind" : "ClassType",
"location" : [ 1, 4, 1, 6 ],
"className" : "int"
}
}
},
"value" : {
"kind" : "NoneLiteral",
"location" : [ 1, 11, 1, 14 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
}
} ],
"statements" : [ {
"kind" : "ExprStmt",
"location" : [ 3, 1, 3, 11 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 3, 1, 3, 11 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 3, 1, 3, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "IndexExpr",
"location" : [ 3, 7, 3, 10 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"list" : {
"kind" : "Identifier",
"location" : [ 3, 7, 3, 7 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
},
"index" : {
"kind" : "IntegerLiteral",
"location" : [ 3, 9, 3, 9 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 0
}
} ]
}
} ],
"errors" : {
"errors" : [ ],
"kind" : "Errors",
"location" : [ 0, 0, 0, 0 ]
}
}
@@ -0,0 +1,2 @@
Operation on None
Exited with error code 4
+4
View File
@@ -0,0 +1,4 @@
x:[int] = None
x = [1, 2, 3]
print(x[-1])
@@ -0,0 +1,156 @@
{
"kind" : "Program",
"location" : [ 1, 1, 4, 13 ],
"declarations" : [ {
"kind" : "VarDef",
"location" : [ 1, 1, 1, 14 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 1, 1, 1, 7 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 1, 1, 1, 1 ],
"name" : "x"
},
"type" : {
"kind" : "ListType",
"location" : [ 1, 3, 1, 7 ],
"elementType" : {
"kind" : "ClassType",
"location" : [ 1, 4, 1, 6 ],
"className" : "int"
}
}
},
"value" : {
"kind" : "NoneLiteral",
"location" : [ 1, 11, 1, 14 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
}
} ],
"statements" : [ {
"kind" : "AssignStmt",
"location" : [ 3, 1, 3, 13 ],
"targets" : [ {
"kind" : "Identifier",
"location" : [ 3, 1, 3, 1 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
} ],
"value" : {
"kind" : "ListExpr",
"location" : [ 3, 5, 3, 13 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"elements" : [ {
"kind" : "IntegerLiteral",
"location" : [ 3, 6, 3, 6 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 1
}, {
"kind" : "IntegerLiteral",
"location" : [ 3, 9, 3, 9 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 2
}, {
"kind" : "IntegerLiteral",
"location" : [ 3, 12, 3, 12 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 3
} ]
}
}, {
"kind" : "ExprStmt",
"location" : [ 4, 1, 4, 12 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 4, 1, 4, 12 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 4, 1, 4, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "IndexExpr",
"location" : [ 4, 7, 4, 11 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"list" : {
"kind" : "Identifier",
"location" : [ 4, 7, 4, 7 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
},
"index" : {
"kind" : "UnaryExpr",
"location" : [ 4, 9, 4, 10 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"operator" : "-",
"operand" : {
"kind" : "IntegerLiteral",
"location" : [ 4, 10, 4, 10 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 1
}
}
} ]
}
} ],
"errors" : {
"errors" : [ ],
"kind" : "Errors",
"location" : [ 0, 0, 0, 0 ]
}
}
@@ -0,0 +1,2 @@
Index out of bounds
Exited with error code 3
+4
View File
@@ -0,0 +1,4 @@
x:[int] = None
x = [1, 2, 3]
print(x[3])
@@ -0,0 +1,147 @@
{
"kind" : "Program",
"location" : [ 1, 1, 4, 12 ],
"declarations" : [ {
"kind" : "VarDef",
"location" : [ 1, 1, 1, 14 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 1, 1, 1, 7 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 1, 1, 1, 1 ],
"name" : "x"
},
"type" : {
"kind" : "ListType",
"location" : [ 1, 3, 1, 7 ],
"elementType" : {
"kind" : "ClassType",
"location" : [ 1, 4, 1, 6 ],
"className" : "int"
}
}
},
"value" : {
"kind" : "NoneLiteral",
"location" : [ 1, 11, 1, 14 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
}
} ],
"statements" : [ {
"kind" : "AssignStmt",
"location" : [ 3, 1, 3, 13 ],
"targets" : [ {
"kind" : "Identifier",
"location" : [ 3, 1, 3, 1 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
} ],
"value" : {
"kind" : "ListExpr",
"location" : [ 3, 5, 3, 13 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"elements" : [ {
"kind" : "IntegerLiteral",
"location" : [ 3, 6, 3, 6 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 1
}, {
"kind" : "IntegerLiteral",
"location" : [ 3, 9, 3, 9 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 2
}, {
"kind" : "IntegerLiteral",
"location" : [ 3, 12, 3, 12 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 3
} ]
}
}, {
"kind" : "ExprStmt",
"location" : [ 4, 1, 4, 11 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 4, 1, 4, 11 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 4, 1, 4, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "IndexExpr",
"location" : [ 4, 7, 4, 10 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"list" : {
"kind" : "Identifier",
"location" : [ 4, 7, 4, 7 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
},
"index" : {
"kind" : "IntegerLiteral",
"location" : [ 4, 9, 4, 9 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 3
}
} ]
}
} ],
"errors" : {
"errors" : [ ],
"kind" : "Errors",
"location" : [ 0, 0, 0, 0 ]
}
}
@@ -0,0 +1,2 @@
Index out of bounds
Exited with error code 3
+4
View File
@@ -0,0 +1,4 @@
x:[int] = None
x = []
print(x[0])
@@ -0,0 +1,120 @@
{
"kind" : "Program",
"location" : [ 1, 1, 4, 12 ],
"declarations" : [ {
"kind" : "VarDef",
"location" : [ 1, 1, 1, 14 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 1, 1, 1, 7 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 1, 1, 1, 1 ],
"name" : "x"
},
"type" : {
"kind" : "ListType",
"location" : [ 1, 3, 1, 7 ],
"elementType" : {
"kind" : "ClassType",
"location" : [ 1, 4, 1, 6 ],
"className" : "int"
}
}
},
"value" : {
"kind" : "NoneLiteral",
"location" : [ 1, 11, 1, 14 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
}
} ],
"statements" : [ {
"kind" : "AssignStmt",
"location" : [ 3, 1, 3, 6 ],
"targets" : [ {
"kind" : "Identifier",
"location" : [ 3, 1, 3, 1 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
} ],
"value" : {
"kind" : "ListExpr",
"location" : [ 3, 5, 3, 6 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<Empty>"
},
"elements" : [ ]
}
}, {
"kind" : "ExprStmt",
"location" : [ 4, 1, 4, 11 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 4, 1, 4, 11 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 4, 1, 4, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "IndexExpr",
"location" : [ 4, 7, 4, 10 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"list" : {
"kind" : "Identifier",
"location" : [ 4, 7, 4, 7 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
},
"index" : {
"kind" : "IntegerLiteral",
"location" : [ 4, 9, 4, 9 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 0
}
} ]
}
} ],
"errors" : {
"errors" : [ ],
"kind" : "Errors",
"location" : [ 0, 0, 0, 0 ]
}
}
@@ -0,0 +1,2 @@
Index out of bounds
Exited with error code 3
+4
View File
@@ -0,0 +1,4 @@
x:[int] = None
x = [1, 2, 3]
print(len(x))
+154
View File
@@ -0,0 +1,154 @@
{
"kind" : "Program",
"location" : [ 1, 1, 4, 14 ],
"declarations" : [ {
"kind" : "VarDef",
"location" : [ 1, 1, 1, 14 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 1, 1, 1, 7 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 1, 1, 1, 1 ],
"name" : "x"
},
"type" : {
"kind" : "ListType",
"location" : [ 1, 3, 1, 7 ],
"elementType" : {
"kind" : "ClassType",
"location" : [ 1, 4, 1, 6 ],
"className" : "int"
}
}
},
"value" : {
"kind" : "NoneLiteral",
"location" : [ 1, 11, 1, 14 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
}
} ],
"statements" : [ {
"kind" : "AssignStmt",
"location" : [ 3, 1, 3, 13 ],
"targets" : [ {
"kind" : "Identifier",
"location" : [ 3, 1, 3, 1 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
} ],
"value" : {
"kind" : "ListExpr",
"location" : [ 3, 5, 3, 13 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"elements" : [ {
"kind" : "IntegerLiteral",
"location" : [ 3, 6, 3, 6 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 1
}, {
"kind" : "IntegerLiteral",
"location" : [ 3, 9, 3, 9 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 2
}, {
"kind" : "IntegerLiteral",
"location" : [ 3, 12, 3, 12 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 3
} ]
}
}, {
"kind" : "ExprStmt",
"location" : [ 4, 1, 4, 13 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 4, 1, 4, 13 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 4, 1, 4, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "CallExpr",
"location" : [ 4, 7, 4, 12 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"function" : {
"kind" : "Identifier",
"location" : [ 4, 7, 4, 9 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "len"
},
"args" : [ {
"kind" : "Identifier",
"location" : [ 4, 11, 4, 11 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
} ]
} ]
}
} ],
"errors" : {
"errors" : [ ],
"kind" : "Errors",
"location" : [ 0, 0, 0, 0 ]
}
}
@@ -0,0 +1 @@
3
+4
View File
@@ -0,0 +1,4 @@
x:[int] = None
x = []
print(len(x))
+127
View File
@@ -0,0 +1,127 @@
{
"kind" : "Program",
"location" : [ 1, 1, 4, 14 ],
"declarations" : [ {
"kind" : "VarDef",
"location" : [ 1, 1, 1, 14 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 1, 1, 1, 7 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 1, 1, 1, 1 ],
"name" : "x"
},
"type" : {
"kind" : "ListType",
"location" : [ 1, 3, 1, 7 ],
"elementType" : {
"kind" : "ClassType",
"location" : [ 1, 4, 1, 6 ],
"className" : "int"
}
}
},
"value" : {
"kind" : "NoneLiteral",
"location" : [ 1, 11, 1, 14 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
}
} ],
"statements" : [ {
"kind" : "AssignStmt",
"location" : [ 3, 1, 3, 6 ],
"targets" : [ {
"kind" : "Identifier",
"location" : [ 3, 1, 3, 1 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
} ],
"value" : {
"kind" : "ListExpr",
"location" : [ 3, 5, 3, 6 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<Empty>"
},
"elements" : [ ]
}
}, {
"kind" : "ExprStmt",
"location" : [ 4, 1, 4, 13 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 4, 1, 4, 13 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 4, 1, 4, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "CallExpr",
"location" : [ 4, 7, 4, 12 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"function" : {
"kind" : "Identifier",
"location" : [ 4, 7, 4, 9 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "len"
},
"args" : [ {
"kind" : "Identifier",
"location" : [ 4, 11, 4, 11 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
} ]
} ]
}
} ],
"errors" : {
"errors" : [ ],
"kind" : "Errors",
"location" : [ 0, 0, 0, 0 ]
}
}
@@ -0,0 +1 @@
0
+9
View File
@@ -0,0 +1,9 @@
x:[int] = None
x = [1, 2, 3]
x[0] = 4
x[1] = 5
x[2] = 6
print(x[0])
print(x[1])
print(x[2])
@@ -0,0 +1,382 @@
{
"kind" : "Program",
"location" : [ 1, 1, 9, 12 ],
"declarations" : [ {
"kind" : "VarDef",
"location" : [ 1, 1, 1, 14 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 1, 1, 1, 7 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 1, 1, 1, 1 ],
"name" : "x"
},
"type" : {
"kind" : "ListType",
"location" : [ 1, 3, 1, 7 ],
"elementType" : {
"kind" : "ClassType",
"location" : [ 1, 4, 1, 6 ],
"className" : "int"
}
}
},
"value" : {
"kind" : "NoneLiteral",
"location" : [ 1, 11, 1, 14 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
}
} ],
"statements" : [ {
"kind" : "AssignStmt",
"location" : [ 3, 1, 3, 13 ],
"targets" : [ {
"kind" : "Identifier",
"location" : [ 3, 1, 3, 1 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
} ],
"value" : {
"kind" : "ListExpr",
"location" : [ 3, 5, 3, 13 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"elements" : [ {
"kind" : "IntegerLiteral",
"location" : [ 3, 6, 3, 6 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 1
}, {
"kind" : "IntegerLiteral",
"location" : [ 3, 9, 3, 9 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 2
}, {
"kind" : "IntegerLiteral",
"location" : [ 3, 12, 3, 12 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 3
} ]
}
}, {
"kind" : "AssignStmt",
"location" : [ 4, 1, 4, 8 ],
"targets" : [ {
"kind" : "IndexExpr",
"location" : [ 4, 1, 4, 4 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"list" : {
"kind" : "Identifier",
"location" : [ 4, 1, 4, 1 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
},
"index" : {
"kind" : "IntegerLiteral",
"location" : [ 4, 3, 4, 3 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 0
}
} ],
"value" : {
"kind" : "IntegerLiteral",
"location" : [ 4, 8, 4, 8 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 4
}
}, {
"kind" : "AssignStmt",
"location" : [ 5, 1, 5, 8 ],
"targets" : [ {
"kind" : "IndexExpr",
"location" : [ 5, 1, 5, 4 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"list" : {
"kind" : "Identifier",
"location" : [ 5, 1, 5, 1 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
},
"index" : {
"kind" : "IntegerLiteral",
"location" : [ 5, 3, 5, 3 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 1
}
} ],
"value" : {
"kind" : "IntegerLiteral",
"location" : [ 5, 8, 5, 8 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 5
}
}, {
"kind" : "AssignStmt",
"location" : [ 6, 1, 6, 8 ],
"targets" : [ {
"kind" : "IndexExpr",
"location" : [ 6, 1, 6, 4 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"list" : {
"kind" : "Identifier",
"location" : [ 6, 1, 6, 1 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
},
"index" : {
"kind" : "IntegerLiteral",
"location" : [ 6, 3, 6, 3 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 2
}
} ],
"value" : {
"kind" : "IntegerLiteral",
"location" : [ 6, 8, 6, 8 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 6
}
}, {
"kind" : "ExprStmt",
"location" : [ 7, 1, 7, 11 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 7, 1, 7, 11 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 7, 1, 7, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "IndexExpr",
"location" : [ 7, 7, 7, 10 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"list" : {
"kind" : "Identifier",
"location" : [ 7, 7, 7, 7 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
},
"index" : {
"kind" : "IntegerLiteral",
"location" : [ 7, 9, 7, 9 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 0
}
} ]
}
}, {
"kind" : "ExprStmt",
"location" : [ 8, 1, 8, 11 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 8, 1, 8, 11 ],
"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" : "IndexExpr",
"location" : [ 8, 7, 8, 10 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"list" : {
"kind" : "Identifier",
"location" : [ 8, 7, 8, 7 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
},
"index" : {
"kind" : "IntegerLiteral",
"location" : [ 8, 9, 8, 9 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 1
}
} ]
}
}, {
"kind" : "ExprStmt",
"location" : [ 9, 1, 9, 11 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 9, 1, 9, 11 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 9, 1, 9, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "IndexExpr",
"location" : [ 9, 7, 9, 10 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"list" : {
"kind" : "Identifier",
"location" : [ 9, 7, 9, 7 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
},
"index" : {
"kind" : "IntegerLiteral",
"location" : [ 9, 9, 9, 9 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 2
}
} ]
}
} ],
"errors" : {
"errors" : [ ],
"kind" : "Errors",
"location" : [ 0, 0, 0, 0 ]
}
}
@@ -0,0 +1,3 @@
4
5
6
+4
View File
@@ -0,0 +1,4 @@
x:[int] = None
x[0] = 1
@@ -0,0 +1,81 @@
{
"kind" : "Program",
"location" : [ 1, 1, 3, 9 ],
"declarations" : [ {
"kind" : "VarDef",
"location" : [ 1, 1, 1, 14 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 1, 1, 1, 7 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 1, 1, 1, 1 ],
"name" : "x"
},
"type" : {
"kind" : "ListType",
"location" : [ 1, 3, 1, 7 ],
"elementType" : {
"kind" : "ClassType",
"location" : [ 1, 4, 1, 6 ],
"className" : "int"
}
}
},
"value" : {
"kind" : "NoneLiteral",
"location" : [ 1, 11, 1, 14 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
}
} ],
"statements" : [ {
"kind" : "AssignStmt",
"location" : [ 3, 1, 3, 8 ],
"targets" : [ {
"kind" : "IndexExpr",
"location" : [ 3, 1, 3, 4 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"list" : {
"kind" : "Identifier",
"location" : [ 3, 1, 3, 1 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
},
"index" : {
"kind" : "IntegerLiteral",
"location" : [ 3, 3, 3, 3 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 0
}
} ],
"value" : {
"kind" : "IntegerLiteral",
"location" : [ 3, 8, 3, 8 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 1
}
} ],
"errors" : {
"errors" : [ ],
"kind" : "Errors",
"location" : [ 0, 0, 0, 0 ]
}
}
@@ -0,0 +1,2 @@
Operation on None
Exited with error code 4
+7
View File
@@ -0,0 +1,7 @@
x:[int] = None
x = [1, 2, 3]
x[-1] = 4
print(x[0])
print(x[1])
print(x[2])
@@ -0,0 +1,309 @@
{
"kind" : "Program",
"location" : [ 1, 1, 7, 12 ],
"declarations" : [ {
"kind" : "VarDef",
"location" : [ 1, 1, 1, 14 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 1, 1, 1, 7 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 1, 1, 1, 1 ],
"name" : "x"
},
"type" : {
"kind" : "ListType",
"location" : [ 1, 3, 1, 7 ],
"elementType" : {
"kind" : "ClassType",
"location" : [ 1, 4, 1, 6 ],
"className" : "int"
}
}
},
"value" : {
"kind" : "NoneLiteral",
"location" : [ 1, 11, 1, 14 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
}
} ],
"statements" : [ {
"kind" : "AssignStmt",
"location" : [ 3, 1, 3, 13 ],
"targets" : [ {
"kind" : "Identifier",
"location" : [ 3, 1, 3, 1 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
} ],
"value" : {
"kind" : "ListExpr",
"location" : [ 3, 5, 3, 13 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"elements" : [ {
"kind" : "IntegerLiteral",
"location" : [ 3, 6, 3, 6 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 1
}, {
"kind" : "IntegerLiteral",
"location" : [ 3, 9, 3, 9 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 2
}, {
"kind" : "IntegerLiteral",
"location" : [ 3, 12, 3, 12 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 3
} ]
}
}, {
"kind" : "AssignStmt",
"location" : [ 4, 1, 4, 9 ],
"targets" : [ {
"kind" : "IndexExpr",
"location" : [ 4, 1, 4, 5 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"list" : {
"kind" : "Identifier",
"location" : [ 4, 1, 4, 1 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
},
"index" : {
"kind" : "UnaryExpr",
"location" : [ 4, 3, 4, 4 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"operator" : "-",
"operand" : {
"kind" : "IntegerLiteral",
"location" : [ 4, 4, 4, 4 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 1
}
}
} ],
"value" : {
"kind" : "IntegerLiteral",
"location" : [ 4, 9, 4, 9 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 4
}
}, {
"kind" : "ExprStmt",
"location" : [ 5, 1, 5, 11 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 5, 1, 5, 11 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 5, 1, 5, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "IndexExpr",
"location" : [ 5, 7, 5, 10 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"list" : {
"kind" : "Identifier",
"location" : [ 5, 7, 5, 7 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
},
"index" : {
"kind" : "IntegerLiteral",
"location" : [ 5, 9, 5, 9 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 0
}
} ]
}
}, {
"kind" : "ExprStmt",
"location" : [ 6, 1, 6, 11 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 6, 1, 6, 11 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 6, 1, 6, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "IndexExpr",
"location" : [ 6, 7, 6, 10 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"list" : {
"kind" : "Identifier",
"location" : [ 6, 7, 6, 7 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
},
"index" : {
"kind" : "IntegerLiteral",
"location" : [ 6, 9, 6, 9 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 1
}
} ]
}
}, {
"kind" : "ExprStmt",
"location" : [ 7, 1, 7, 11 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 7, 1, 7, 11 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 7, 1, 7, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "IndexExpr",
"location" : [ 7, 7, 7, 10 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"list" : {
"kind" : "Identifier",
"location" : [ 7, 7, 7, 7 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
},
"index" : {
"kind" : "IntegerLiteral",
"location" : [ 7, 9, 7, 9 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 2
}
} ]
}
} ],
"errors" : {
"errors" : [ ],
"kind" : "Errors",
"location" : [ 0, 0, 0, 0 ]
}
}
@@ -0,0 +1,2 @@
Index out of bounds
Exited with error code 3
+7
View File
@@ -0,0 +1,7 @@
x:[int] = None
x = [1, 2, 3]
x[4] = 4
print(x[0])
print(x[1])
print(x[2])
@@ -0,0 +1,300 @@
{
"kind" : "Program",
"location" : [ 1, 1, 7, 12 ],
"declarations" : [ {
"kind" : "VarDef",
"location" : [ 1, 1, 1, 14 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 1, 1, 1, 7 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 1, 1, 1, 1 ],
"name" : "x"
},
"type" : {
"kind" : "ListType",
"location" : [ 1, 3, 1, 7 ],
"elementType" : {
"kind" : "ClassType",
"location" : [ 1, 4, 1, 6 ],
"className" : "int"
}
}
},
"value" : {
"kind" : "NoneLiteral",
"location" : [ 1, 11, 1, 14 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
}
} ],
"statements" : [ {
"kind" : "AssignStmt",
"location" : [ 3, 1, 3, 13 ],
"targets" : [ {
"kind" : "Identifier",
"location" : [ 3, 1, 3, 1 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
} ],
"value" : {
"kind" : "ListExpr",
"location" : [ 3, 5, 3, 13 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"elements" : [ {
"kind" : "IntegerLiteral",
"location" : [ 3, 6, 3, 6 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 1
}, {
"kind" : "IntegerLiteral",
"location" : [ 3, 9, 3, 9 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 2
}, {
"kind" : "IntegerLiteral",
"location" : [ 3, 12, 3, 12 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 3
} ]
}
}, {
"kind" : "AssignStmt",
"location" : [ 4, 1, 4, 8 ],
"targets" : [ {
"kind" : "IndexExpr",
"location" : [ 4, 1, 4, 4 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"list" : {
"kind" : "Identifier",
"location" : [ 4, 1, 4, 1 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
},
"index" : {
"kind" : "IntegerLiteral",
"location" : [ 4, 3, 4, 3 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 4
}
} ],
"value" : {
"kind" : "IntegerLiteral",
"location" : [ 4, 8, 4, 8 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 4
}
}, {
"kind" : "ExprStmt",
"location" : [ 5, 1, 5, 11 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 5, 1, 5, 11 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 5, 1, 5, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "IndexExpr",
"location" : [ 5, 7, 5, 10 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"list" : {
"kind" : "Identifier",
"location" : [ 5, 7, 5, 7 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
},
"index" : {
"kind" : "IntegerLiteral",
"location" : [ 5, 9, 5, 9 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 0
}
} ]
}
}, {
"kind" : "ExprStmt",
"location" : [ 6, 1, 6, 11 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 6, 1, 6, 11 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 6, 1, 6, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "IndexExpr",
"location" : [ 6, 7, 6, 10 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"list" : {
"kind" : "Identifier",
"location" : [ 6, 7, 6, 7 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
},
"index" : {
"kind" : "IntegerLiteral",
"location" : [ 6, 9, 6, 9 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 1
}
} ]
}
}, {
"kind" : "ExprStmt",
"location" : [ 7, 1, 7, 11 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 7, 1, 7, 11 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 7, 1, 7, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "IndexExpr",
"location" : [ 7, 7, 7, 10 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"list" : {
"kind" : "Identifier",
"location" : [ 7, 7, 7, 7 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
},
"index" : {
"kind" : "IntegerLiteral",
"location" : [ 7, 9, 7, 9 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 2
}
} ]
}
} ],
"errors" : {
"errors" : [ ],
"kind" : "Errors",
"location" : [ 0, 0, 0, 0 ]
}
}
@@ -0,0 +1,2 @@
Index out of bounds
Exited with error code 3
+4
View File
@@ -0,0 +1,4 @@
x:[int] = None
x = []
x[0] = 4
@@ -0,0 +1,105 @@
{
"kind" : "Program",
"location" : [ 1, 1, 4, 9 ],
"declarations" : [ {
"kind" : "VarDef",
"location" : [ 1, 1, 1, 14 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 1, 1, 1, 7 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 1, 1, 1, 1 ],
"name" : "x"
},
"type" : {
"kind" : "ListType",
"location" : [ 1, 3, 1, 7 ],
"elementType" : {
"kind" : "ClassType",
"location" : [ 1, 4, 1, 6 ],
"className" : "int"
}
}
},
"value" : {
"kind" : "NoneLiteral",
"location" : [ 1, 11, 1, 14 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
}
} ],
"statements" : [ {
"kind" : "AssignStmt",
"location" : [ 3, 1, 3, 6 ],
"targets" : [ {
"kind" : "Identifier",
"location" : [ 3, 1, 3, 1 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
} ],
"value" : {
"kind" : "ListExpr",
"location" : [ 3, 5, 3, 6 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<Empty>"
},
"elements" : [ ]
}
}, {
"kind" : "AssignStmt",
"location" : [ 4, 1, 4, 8 ],
"targets" : [ {
"kind" : "IndexExpr",
"location" : [ 4, 1, 4, 4 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"list" : {
"kind" : "Identifier",
"location" : [ 4, 1, 4, 1 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
},
"index" : {
"kind" : "IntegerLiteral",
"location" : [ 4, 3, 4, 3 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 0
}
} ],
"value" : {
"kind" : "IntegerLiteral",
"location" : [ 4, 8, 4, 8 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 4
}
} ],
"errors" : {
"errors" : [ ],
"kind" : "Errors",
"location" : [ 0, 0, 0, 0 ]
}
}
@@ -0,0 +1,2 @@
Index out of bounds
Exited with error code 3
+2
View File
@@ -0,0 +1,2 @@
print(True)
print(False)
+83
View File
@@ -0,0 +1,83 @@
{
"kind" : "Program",
"location" : [ 1, 1, 2, 13 ],
"declarations" : [ ],
"statements" : [ {
"kind" : "ExprStmt",
"location" : [ 1, 1, 1, 11 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 1, 1, 1, 11 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 1, 1, 1, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "BooleanLiteral",
"location" : [ 1, 7, 1, 10 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "bool"
},
"value" : true
} ]
}
}, {
"kind" : "ExprStmt",
"location" : [ 2, 1, 2, 12 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 2, 1, 2, 12 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 2, 1, 2, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "BooleanLiteral",
"location" : [ 2, 7, 2, 11 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "bool"
},
"value" : false
} ]
}
} ],
"errors" : {
"errors" : [ ],
"kind" : "Errors",
"location" : [ 0, 0, 0, 0 ]
}
}
@@ -0,0 +1,2 @@
True
False
+2
View File
@@ -0,0 +1,2 @@
print(42)
print(65999)
+83
View File
@@ -0,0 +1,83 @@
{
"kind" : "Program",
"location" : [ 1, 1, 2, 13 ],
"declarations" : [ ],
"statements" : [ {
"kind" : "ExprStmt",
"location" : [ 1, 1, 1, 9 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 1, 1, 1, 9 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 1, 1, 1, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "IntegerLiteral",
"location" : [ 1, 7, 1, 8 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 42
} ]
}
}, {
"kind" : "ExprStmt",
"location" : [ 2, 1, 2, 12 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 2, 1, 2, 12 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 2, 1, 2, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "IntegerLiteral",
"location" : [ 2, 7, 2, 11 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 65999
} ]
}
} ],
"errors" : {
"errors" : [ ],
"kind" : "Errors",
"location" : [ 0, 0, 0, 0 ]
}
}
@@ -0,0 +1,2 @@
42
65999
+1
View File
@@ -0,0 +1 @@
print("Hello World")
+47
View File
@@ -0,0 +1,47 @@
{
"kind" : "Program",
"location" : [ 1, 1, 1, 21 ],
"declarations" : [ ],
"statements" : [ {
"kind" : "ExprStmt",
"location" : [ 1, 1, 1, 20 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 1, 1, 1, 20 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 1, 1, 1, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "StringLiteral",
"location" : [ 1, 7, 1, 19 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "str"
},
"value" : "Hello World"
} ]
}
} ],
"errors" : {
"errors" : [ ],
"kind" : "Errors",
"location" : [ 0, 0, 0, 0 ]
}
}
@@ -0,0 +1 @@
Hello World
+11
View File
@@ -0,0 +1,11 @@
g: int = 1
def foo(x: int) -> int:
y: int = 2
def bar() -> int:
z: int = 3
def baz() -> int:
return y
return baz()
return bar()
print(foo(g))
+272
View File
@@ -0,0 +1,272 @@
{
"kind" : "Program",
"location" : [ 1, 1, 11, 14 ],
"declarations" : [ {
"kind" : "VarDef",
"location" : [ 1, 1, 1, 10 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 1, 1, 1, 6 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 1, 1, 1, 1 ],
"name" : "g"
},
"type" : {
"kind" : "ClassType",
"location" : [ 1, 4, 1, 6 ],
"className" : "int"
}
},
"value" : {
"kind" : "IntegerLiteral",
"location" : [ 1, 10, 1, 10 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 1
}
}, {
"kind" : "FuncDef",
"location" : [ 2, 1, 9, 17 ],
"name" : {
"kind" : "Identifier",
"location" : [ 2, 5, 2, 7 ],
"name" : "foo"
},
"params" : [ {
"kind" : "TypedVar",
"location" : [ 2, 9, 2, 14 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 2, 9, 2, 9 ],
"name" : "x"
},
"type" : {
"kind" : "ClassType",
"location" : [ 2, 12, 2, 14 ],
"className" : "int"
}
} ],
"returnType" : {
"kind" : "ClassType",
"location" : [ 2, 20, 2, 22 ],
"className" : "int"
},
"declarations" : [ {
"kind" : "VarDef",
"location" : [ 3, 5, 3, 14 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 3, 5, 3, 10 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 3, 5, 3, 5 ],
"name" : "y"
},
"type" : {
"kind" : "ClassType",
"location" : [ 3, 8, 3, 10 ],
"className" : "int"
}
},
"value" : {
"kind" : "IntegerLiteral",
"location" : [ 3, 14, 3, 14 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 2
}
}, {
"kind" : "FuncDef",
"location" : [ 4, 5, 8, 21 ],
"name" : {
"kind" : "Identifier",
"location" : [ 4, 9, 4, 11 ],
"name" : "bar"
},
"params" : [ ],
"returnType" : {
"kind" : "ClassType",
"location" : [ 4, 18, 4, 20 ],
"className" : "int"
},
"declarations" : [ {
"kind" : "VarDef",
"location" : [ 5, 9, 5, 18 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 5, 9, 5, 14 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 5, 9, 5, 9 ],
"name" : "z"
},
"type" : {
"kind" : "ClassType",
"location" : [ 5, 12, 5, 14 ],
"className" : "int"
}
},
"value" : {
"kind" : "IntegerLiteral",
"location" : [ 5, 18, 5, 18 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 3
}
}, {
"kind" : "FuncDef",
"location" : [ 6, 9, 7, 21 ],
"name" : {
"kind" : "Identifier",
"location" : [ 6, 13, 6, 15 ],
"name" : "baz"
},
"params" : [ ],
"returnType" : {
"kind" : "ClassType",
"location" : [ 6, 22, 6, 24 ],
"className" : "int"
},
"declarations" : [ ],
"statements" : [ {
"kind" : "ReturnStmt",
"location" : [ 7, 13, 7, 20 ],
"value" : {
"kind" : "Identifier",
"location" : [ 7, 20, 7, 20 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"name" : "y"
}
} ]
} ],
"statements" : [ {
"kind" : "ReturnStmt",
"location" : [ 8, 9, 8, 20 ],
"value" : {
"kind" : "CallExpr",
"location" : [ 8, 16, 8, 20 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"function" : {
"kind" : "Identifier",
"location" : [ 8, 16, 8, 18 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "baz"
},
"args" : [ ]
}
} ]
} ],
"statements" : [ {
"kind" : "ReturnStmt",
"location" : [ 9, 5, 9, 16 ],
"value" : {
"kind" : "CallExpr",
"location" : [ 9, 12, 9, 16 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"function" : {
"kind" : "Identifier",
"location" : [ 9, 12, 9, 14 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "bar"
},
"args" : [ ]
}
} ]
} ],
"statements" : [ {
"kind" : "ExprStmt",
"location" : [ 11, 1, 11, 13 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 11, 1, 11, 13 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 11, 1, 11, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "CallExpr",
"location" : [ 11, 7, 11, 12 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"function" : {
"kind" : "Identifier",
"location" : [ 11, 7, 11, 9 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "int"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "foo"
},
"args" : [ {
"kind" : "Identifier",
"location" : [ 11, 11, 11, 11 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"name" : "g"
} ]
} ]
}
} ],
"errors" : {
"errors" : [ ],
"kind" : "Errors",
"location" : [ 0, 0, 0, 0 ]
}
}
@@ -0,0 +1 @@
2
+14
View File
@@ -0,0 +1,14 @@
g: int = 1
def foo(x: int) -> int:
y: int = 2
def bar() -> int:
z: int = 3
def baz() -> int:
return qux(y)
return baz()
def qux(p: int) -> int:
return p
return bar()
print(foo(g))
+337
View File
@@ -0,0 +1,337 @@
{
"kind" : "Program",
"location" : [ 1, 1, 14, 14 ],
"declarations" : [ {
"kind" : "VarDef",
"location" : [ 1, 1, 1, 10 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 1, 1, 1, 6 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 1, 1, 1, 1 ],
"name" : "g"
},
"type" : {
"kind" : "ClassType",
"location" : [ 1, 4, 1, 6 ],
"className" : "int"
}
},
"value" : {
"kind" : "IntegerLiteral",
"location" : [ 1, 10, 1, 10 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 1
}
}, {
"kind" : "FuncDef",
"location" : [ 2, 1, 12, 17 ],
"name" : {
"kind" : "Identifier",
"location" : [ 2, 5, 2, 7 ],
"name" : "foo"
},
"params" : [ {
"kind" : "TypedVar",
"location" : [ 2, 9, 2, 14 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 2, 9, 2, 9 ],
"name" : "x"
},
"type" : {
"kind" : "ClassType",
"location" : [ 2, 12, 2, 14 ],
"className" : "int"
}
} ],
"returnType" : {
"kind" : "ClassType",
"location" : [ 2, 20, 2, 22 ],
"className" : "int"
},
"declarations" : [ {
"kind" : "VarDef",
"location" : [ 3, 5, 3, 14 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 3, 5, 3, 10 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 3, 5, 3, 5 ],
"name" : "y"
},
"type" : {
"kind" : "ClassType",
"location" : [ 3, 8, 3, 10 ],
"className" : "int"
}
},
"value" : {
"kind" : "IntegerLiteral",
"location" : [ 3, 14, 3, 14 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 2
}
}, {
"kind" : "FuncDef",
"location" : [ 4, 5, 8, 21 ],
"name" : {
"kind" : "Identifier",
"location" : [ 4, 9, 4, 11 ],
"name" : "bar"
},
"params" : [ ],
"returnType" : {
"kind" : "ClassType",
"location" : [ 4, 18, 4, 20 ],
"className" : "int"
},
"declarations" : [ {
"kind" : "VarDef",
"location" : [ 5, 9, 5, 18 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 5, 9, 5, 14 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 5, 9, 5, 9 ],
"name" : "z"
},
"type" : {
"kind" : "ClassType",
"location" : [ 5, 12, 5, 14 ],
"className" : "int"
}
},
"value" : {
"kind" : "IntegerLiteral",
"location" : [ 5, 18, 5, 18 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 3
}
}, {
"kind" : "FuncDef",
"location" : [ 6, 9, 7, 26 ],
"name" : {
"kind" : "Identifier",
"location" : [ 6, 13, 6, 15 ],
"name" : "baz"
},
"params" : [ ],
"returnType" : {
"kind" : "ClassType",
"location" : [ 6, 22, 6, 24 ],
"className" : "int"
},
"declarations" : [ ],
"statements" : [ {
"kind" : "ReturnStmt",
"location" : [ 7, 13, 7, 25 ],
"value" : {
"kind" : "CallExpr",
"location" : [ 7, 20, 7, 25 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"function" : {
"kind" : "Identifier",
"location" : [ 7, 20, 7, 22 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "int"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "qux"
},
"args" : [ {
"kind" : "Identifier",
"location" : [ 7, 24, 7, 24 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"name" : "y"
} ]
}
} ]
} ],
"statements" : [ {
"kind" : "ReturnStmt",
"location" : [ 8, 9, 8, 20 ],
"value" : {
"kind" : "CallExpr",
"location" : [ 8, 16, 8, 20 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"function" : {
"kind" : "Identifier",
"location" : [ 8, 16, 8, 18 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "baz"
},
"args" : [ ]
}
} ]
}, {
"kind" : "FuncDef",
"location" : [ 9, 5, 10, 17 ],
"name" : {
"kind" : "Identifier",
"location" : [ 9, 9, 9, 11 ],
"name" : "qux"
},
"params" : [ {
"kind" : "TypedVar",
"location" : [ 9, 13, 9, 18 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 9, 13, 9, 13 ],
"name" : "p"
},
"type" : {
"kind" : "ClassType",
"location" : [ 9, 16, 9, 18 ],
"className" : "int"
}
} ],
"returnType" : {
"kind" : "ClassType",
"location" : [ 9, 24, 9, 26 ],
"className" : "int"
},
"declarations" : [ ],
"statements" : [ {
"kind" : "ReturnStmt",
"location" : [ 10, 9, 10, 16 ],
"value" : {
"kind" : "Identifier",
"location" : [ 10, 16, 10, 16 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"name" : "p"
}
} ]
} ],
"statements" : [ {
"kind" : "ReturnStmt",
"location" : [ 12, 5, 12, 16 ],
"value" : {
"kind" : "CallExpr",
"location" : [ 12, 12, 12, 16 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"function" : {
"kind" : "Identifier",
"location" : [ 12, 12, 12, 14 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "bar"
},
"args" : [ ]
}
} ]
} ],
"statements" : [ {
"kind" : "ExprStmt",
"location" : [ 14, 1, 14, 13 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 14, 1, 14, 13 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
},
"function" : {
"kind" : "Identifier",
"location" : [ 14, 1, 14, 5 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "object"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
},
"name" : "print"
},
"args" : [ {
"kind" : "CallExpr",
"location" : [ 14, 7, 14, 12 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"function" : {
"kind" : "Identifier",
"location" : [ 14, 7, 14, 9 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "int"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "foo"
},
"args" : [ {
"kind" : "Identifier",
"location" : [ 14, 11, 14, 11 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"name" : "g"
} ]
} ]
}
} ],
"errors" : {
"errors" : [ ],
"kind" : "Errors",
"location" : [ 0, 0, 0, 0 ]
}
}
@@ -0,0 +1 @@
2
+16
View File
@@ -0,0 +1,16 @@
class A(object):
a:int = 42
class B(A):
b:bool = True
def __init__(self:"B"):
print("B")
a:A = None
b:B = None
a = b = B()
print(a.a)
print(b.a)
print(b.b)

Some files were not shown because too many files have changed in this diff Show More