-
Notifications
You must be signed in to change notification settings - Fork 2
/
test.py
36 lines (34 loc) · 880 Bytes
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
'''
#old
def let_in_end():
#loop through tokenList until last token is read
while index < len(tokenList) - 2:
if nextTok == "let":
match(nextTok)
dec_list()
elif nextTok == "in":
match(nextTok)
varType = type()
progList = expr(varType)
if progList[TYPE] == 'int':
final = (int(progList[VAL]), progList[TYPE])
elif progList[TYPE] == 'real':
final = (float(progList[VAL]), progList[TYPE])
else:
sys.exit('ERROR:\t WRONG VAL ASSIGNMENT')
print final[VAL]
else:
lex()
'''
#new
def let_in_end():
match('let')
dec_list()
match('in')
varType = type()
progList = expr(varType)
match('end')
if nextTok == ';'
return
else:
sys.exit('ERROR')