Merge branch 'bill/merge-flex-cup' of https://github.com/nyu-compiler-construction/pa1-chocopy-parser-mjolnir into bill/merge-flex-cup

master
Sanjar Ahmadov 4 years ago
commit 8869a01c09

@ -1,21 +1,34 @@
class Foo(object):
x:int = 0
print("Hi") def __init__(self:"Foo", x:int):
def fun1(): self.x = x
def fun2():
print("Hello")
fun2()
print("World") def bar(y:int):
print("Hello World!",self.x+y)
y = 10
def fun3(): def get_stones(name:str)->str:
def fun4(): def map_name(nm:str)->str:
return stones[color.index(nm)]
color=["Red","Blue"]
stones=["Mind","Soul"]
return map_name(name)
def funa():
def funb():
print("Hello")
funb()
def fund():
def fune():
print("Hello") print("Hello")
c = 4 + 5 c = 4 + 5
def fun5(): def funf():
c = 6 def fung():
def fun6():
print("Hello") print("Hello")
c = 6
c = 4 + 5 c = 4 + 5
@ -51,38 +64,17 @@ if True:
else: else:
print("World") print("World")
class Foo(object):
x:int = 0
def __init__(self:"Foo", x:int):
self.x = x
def bar(y:int)->None:
print("Hello World!",self.x+y)
y = 10
f = Foo(1) f = Foo(1)
print(f.x) print(f.x)
f.bar(4) f.bar(4)
a=[[[1],[2]][[3],[4]]] a=[[[1],[2]],[[3],[4]]]
print(a[0][0][1]*a[1][1][0]) print(a[0][0][1]*a[1][1][0])
multiline_string="Hi World, multiline_string="Hi World,
Here I am" Here I am"
"""
This is a
multi-line comment.
"""
def get_stones(name:str)->str:
color=['Red','Blue']
stones=['Mind','Soul']
def map_name(nm:str)->str:
return stones[color.index(nm)]
return map_name(name)
stone="Blue" stone="Blue"
print(get_stones(stone)) print(get_stones(stone))
Loading…
Cancel
Save