# CS 3210 - Principles of Programming Languages - Spring 2020
# A bottom-up parser for an expression
# Name: Hussain Al Zerjawi
# Date: 03/03/2020
from enum import IntEnum
import sys
# enables parser's debugging
DEBUG = True
# all char classes
class CharClass(IntEnum):
EOF = -1
LETTER = 1
DIGIT = 2
OPERATOR = 3
PUNCTUATOR = 4
QUOTE = 5
BLANK = 6
DELIMITER = 7
OTHER = 8
# all tokens
class Token(IntEnum):
EOF = 0
INT_TYPE = 1
MAIN = 2
OPEN_PAR = 3
CLOSE_PAR = 4
OPEN_CURLY = 5
CLOSE_CURLY = 6
OPEN_BRACKET = 7
CLOSE_BRACKET = 8
COMMA = 9
ASSIGNMENT = 10
SEMICOLON = 11
IF = 12
ELSE = 13
WHILE = 14
OR = 15
AND = 16
EQUALITY = 17
INEQUALITY = 18
LESS = 19
LESS_EQUAL = 20
GREATER = 21
GREATER_EQUAL = 22
ADD = 23
SUBTRACT = 24
MULTIPLY = 25
DIVIDE = 26
BOOL_TYPE = 27
FLOAT_TYPE = 28
CHAR_TYPE = 29
IDENTIFIER = 30
INT_LITERAL = 31
TRUE = 32
FALSE = 33
FLOAT_LITERAL = 34
CHAR_LITERAL = 35
# a tree-like data structure
class Tree:
TAB = " "
def __init__(self):
self.data = None
self.children = []
def add(self, child):
self.children.append(child)
def print(self, tab = ""):
if self.data != None:
print(tab + self.data)
tab += self.TAB
for child in self.children:
if isinstance(child, Tree):
child.print(tab)
else:
print(tab + child)
# error code to message conversion function
def errorMessage(code):
msg = "Error " + str(code).zfill(2) + ": "
if code == 1:
return msg + "Source file missing"
if code == 2:
return msg + "Couldn't open source file"
if code == 3:
return msg + "Lexical error"
if code == 4:
return msg + "Digit expected"
if code == 5:
return msg + "Symbol missing"
if code == 6:
return msg + "EOF expected"
if code == 7:
return msg + "'}' expected"
if code == 8:
return msg + "'{' expected"
if code == 9:
return msg + "')' expected"
if code == 10:
return msg + "'(' expected"
if code == 11:
return msg + "main expected"
if code == 12:
return msg + "int type expected"
if code == 13:
return msg + "']' expected"
if code == 14:
return msg + "int literal expected"
if code == 15:
return msg + "'[' expected"
if code == 16:
return msg + "identifier expected"
if code == 17:
return msg + "';' expected"
if code == 18:
return msg + "'=' expected"
if code == 19:
return msg + "identifier, if, or while expected"
if code == 20:
return msg + "couldn't open SLR table file"
if code == 21:
return msg + "couldn't open grammar file"
return msg + "syntax error"
# get error code from parse state
def getErrorCode(state, lexeme):
# EOF expected
if state == 6:
return 6
# main expected
if state in [1]:
return 11
# '{' missing
if state in [4]:
return 8
# '}' missing
if state in [57] and lexeme not in ["="]:
return 7
# Error 9: ')' missing
if state in [3]:
return 9
# data type expected
if state in [29]:
return 10
# Error 12: int type expected
if state in [0]:
return 12
# Error 10: '(' expected
if state in [2, 93]:
return 10
# Error 18: '=' expected
if state in [5]:
return 18
# Error 17: '=' expected
if state in [23]:
return 17
# Error 10: '(' expected
if state in [21]:
return 10
# Error 19: identifier if or while expected
if state in [57] and lexeme in ["="]:
return 19
return 99
# lexeme to token conversion map
lookupToken = {
"$" : Token.EOF,
"(" : Token.OPEN_PAR,
")" : Token.CLOSE_PAR,
"{" : Token.OPEN_CURLY,
"}" : Token.CLOSE_CURLY,
"[" : Token.OPEN_BRACKET,
"]" : Token.CLOSE_BRACKET,
"," : Token.COMMA,
"=" : Token.ASSIGNMENT,
";" : Token.SEMICOLON,
"||" : Token.OR,
"&&" : Token.AND,
"==" : Token.EQUALITY,
"!=" : Token.INEQUALITY,
"<" : Token.LESS,
"<=" : Token.LESS_EQUAL,
">" : Token.GREATER,
">=" : Token.GREATER_EQUAL,
"+" : Token.ADD,
"-" : Token.SUBTRACT,
"*" : Token.MULTIPLY,
"/" : Token.DIVIDE,
}
keywords = {
"int" : Token.INT_TYPE,
"main" : Token.MAIN,
"bool" : Token.BOOL_TYPE,
"float" : Token.FLOAT_TYPE,
"char" : Token.CHAR_TYPE,
"true" : Token.TRUE,
"false" : Token.FALSE,
"if" : Token.IF,
"else" : Token.ELSE,
"while" : Token.WHILE,
}
# reads the next char from input and returns its class
def getChar(input):
if len(input) == 0:
return (None, CharClass.EOF)
c = input[0].lower()
if c.isalpha():
return (c, CharClass.LETTER)
if c.isdigit():
return (c, CharClass.DIGIT)
if c in ['"', '\'',]:
return (c, CharClass.QUOTE)
if c in ['+', '-', '*', '/', '>', '=', '<', '<=', '>=', '==', '!=', '&&', '||']:
return (c, CharClass.OPERATOR)
if c in ['.', ';', ',']:
return (c, CharClass.PUNCTUATOR)
if c in [' ', '\n', '\t',]:
return (c, CharClass.BLANK)
if c in ['(', ')', '{', '}', '[', ']']:
return (c, CharClass.DELIMITER)
return (c, CharClass.OTHER)
# calls getChar and addChar until it returns a non-blank
def getNonBlank(input):
ignore = ""
while True:
c, charClass = getChar(input)
if charClass == CharClass.BLANK:
input, ignore = addChar(input, ignore)
else:
return input
# adds the next char from input to lexeme, advancing the input by one char
def addChar(input, lexeme):
if len(input) > 0:
lexeme += input[0]
input = input[1:]
return (input, lexeme)
# returns the next (lexeme, token) pair or ("", EOF) if EOF is reached
def lex(input):
input = getNonBlank(input)
c, charClass = getChar(input)
lexeme = ""
# checks EOF
if charClass == CharClass.EOF:
return (input, lexeme, Token.EOF)
# reads an identifier
if charClass == CharClass.LETTER:
input, lexeme = addChar(input, lexeme)
while True:
c, charClass = getChar(input)
if lexeme in keywords:
return (input, lexeme, keywords[lexeme])
elif charClass == CharClass.LETTER or charClass == CharClass.DIGIT:
input, lexeme = addChar(input, lexeme)
else:
return (input, lexeme, Token.IDENTIFIER)
# reads digits
if charClass == CharClass.DIGIT:
input, lexeme = addChar(input, lexeme)
while True:
c, charClass = getChar(input)
if charClass == CharClass.DIGIT:
input, lexeme = addChar(input, lexeme)
elif c == '.':
input, lexeme = addChar(input, lexeme)
c, charClass = getChar(input)
if charClass == CharClass.DIGIT:
input, lexeme = addChar(input, lexeme)
while True:
c, charClass = getChar(input)
if charClass == CharClass.DIGIT:
input, lexeme = addChar(input, lexeme)
else:
return (input, lexeme, Token.FLOAT_LITERAL)
else:
break
else:
return (input, lexeme, Token.INT_LITERAL)
# reads other
if charClass == CharClass.OTHER:
input, lexeme = addChar(input, lexeme)
if lexeme in lookupToken:
return input, lexeme, lookupToken[lexeme]
# reads quote
if charClass == CharClass.QUOTE:
input, lexeme = addChar(input, lexeme)
while True:
c, charClass = getChar(input)
if charClass == CharClass.QUOTE:
input, lexeme = addChar(input, lexeme)
return input, lexeme, Token.CHAR_LITERAL
else:
input, lexeme = addChar(input, lexeme)
# reads operator, compare, and assignment
if charClass == CharClass.OPERATOR:
input, lexeme = addChar(input, lexeme)
while True:
c, charClass = getChar(input)
if c == "=":
input, lexeme = addChar(input, lexeme)
return input, lexeme, lookupToken[lexeme]
else:
return input, lexeme, lookupToken[lexeme]
# reads punctuator
if charClass == CharClass.PUNCTUATOR:
input, lexeme = addChar(input, lexeme)
while True:
c, charClass = getChar(input)
if lexeme in lookupToken:
return (input, lexeme, lookupToken[lexeme])
# reads parenthesis
if charClass == CharClass.DELIMITER and (c == '(' or c == ')' or c == '[' or c == ']' or c == '{' or c == '}'):
input, lexeme = addChar(input, lexeme)
return (input, lexeme, lookupToken[lexeme])
# anything else, raises an error
raise Exception(errorMessage(3))
# reads the given input and returns the grammar as a list of productions
def loadGrammar(input):
grammar = []
for line in input:
grammar.append(line.strip())
return grammar
# returns the LHS (left hand side) of a given production
def getLHS(production):
return production.split("->")[0].strip()
# returns the RHS (right hand side) of a given production
def getRHS(production):
return production.split("->")[1].strip().split(" ")
# prints the productions of a given grammar, one per line
def printGrammar(grammar):
i = 0
for production in grammar:
print(str(i) + ". " + getLHS(production), end = " -> ")
print(getRHS(production))
i += 1
# reads the given input containing an SLR parsing table and returns the "actions" and "gotos" as dictionaries
def loadTable(input):
actions = {}
gotos = {}
header = input.readline().strip().split(",")
end = header.index("$")
tokens = []
for field in header[1:end]:
tokens.append(int(field))
tokens.append(int(Token.EOF)) # '$' is replaced by token -1
variables = header[end + 1:]
for line in input:
row = line.strip().split(",")
state = int(row[0])
for i in range(len(tokens)):
token = tokens[i]
key = (state, token)
value = row[i + 1]
if len(value) == 0:
value = None
actions[key] = value
for i in range(len(variables)):
variable = variables[i]
key = (state, variable)
value = row[i + len(tokens) + 1]
if len(value) == 0:
value = None
gotos[key] = value
return (actions, gotos)
# prints the given actions, one per line
def printActions(actions):
for key in actions:
print(key, end = " -> ")
print(actions[key])
# prints the given gotos, one per line
def printGotos(gotos):
for key in gotos:
print(key, end = " -> ")
print(gotos[key])
# given an input (source program), a grammar, actions, and gotos, returns the corresponding parse tree or raise an exception if syntax errors were found
def parse(input, grammar, actions, gotos):
# TODOd: create a stack of trees
trees = []
# TODOd: initialize the stack of (state, symbol) pairs
stack = []
stack.append(0)
# initialize lexeme and token variables
lexeme = ""
token = None
# main parser loop
while True:
# get lex info ONLY if token is None
if token is None:
input, lexeme, token = lex(input)
# TODOd: get current state
state = stack[-1]
# print debugging info
if DEBUG:
print("stack:", end = " ")
print(stack, end = " ")
print("(\"" + lexeme + "\", ", end = " ")
print(token, end = ",")
print(" " + str(int(token)) + ")", end = " ")
# TODOd: get action
action = actions[(state, token)]
if DEBUG:
print("action:", end = " ")
print(action)
# if action is undefined, raise an approriate error
if action is None:
errorCode = getErrorCode(state, lexeme)
raise Exception(errorMessage(errorCode))
# TODO: implement the shift operation
if action[0] == 's':
# TODOd: update the stack
stack.append(int(token))
state = int(action[1:])
stack.append(state)
# TODOd: create a new tree, set data to token, and push it onto the list of trees
tree = Tree()
tree.data = lexeme
trees.append(tree)
# set token to None to acknowledge reading the input
token = None
# TODO: implement the reduce operation
elif action[0] == 'r':
# TODOd: get production to use
production = grammar[int(action[1:])]
lhs = getLHS(production)
rhs = getRHS(production)
# TODOd: update the stack
for i in range(len(rhs) * 2):
stack.pop()
state = stack[-1]
stack.append(lhs)
stack.append(int(gotos[(state, lhs)]))
# TODOd: create a new tree and set data to lhs
newTree = Tree()
newTree.data = lhs
# TODOd: get "len(rhs)" trees from the right of the list of trees and add each of them as child of the new tree you created, preserving the left-right order
for tree in trees[-len(rhs):]:
newTree.add(tree)
# TODOd: remove "len(rhs)" trees from the right of the list of trees
trees = trees[:-len(rhs)]
# TODOd: append the new tree to the list of trees
trees.append(newTree)
# TODO: implement the "accept" operation
else:
# TODOd: set lhs as the start symbol; assume that the lhs of the 1st production has the start symbol
production = grammar[0]
lhs = getLHS(production)
# TODOd: reduce all trees to the start symbol
newTree = Tree()
newTree.data = lhs
for tree in trees:
newTree.add(tree)
# TODOd: return the new tree
return newTree
# main
if __name__ == "__main__":
# checks if source file was passed and if it exists
try:
if len(sys.argv) != 2:
raise ValueError(errorMessage(1))
sourceFile = None
try:
sourceFile = open(sys.argv[1], "rt")
except:
pass
if not sourceFile:
raise IOError(errorMessage(2))
input = sourceFile.read()
sourceFile.close()
except Exception as ex:
print(ex)
sys.exit(1)
# main loop
# output = []
# while True:
# input, lexeme, token = lex(input)
# if token == Token.EOF:
# break
# output.append((lexeme, token))
# prints the output
# for (lexeme, token) in output:
# print(lexeme, token)
# load grammar
try:
grammarFile = None
try:
grammarFile = open("./grammar.txt", "rt")
except:
pass
if not grammarFile:
raise IOError(errorMessage(21))
grammar = loadGrammar(grammarFile)
grammarFile.close()
printGrammar(grammar)
except Exception as ex:
print(ex)
sys.exit(1)
# load SLR table
try:
slrTableFile = None
try:
slrTableFile = open("./slr_table.csv", "rt")
except:
pass
if not slrTableFile:
raise IOError(errorMessage(20))
actions, gotos = loadTable(slrTableFile)
slrTableFile.close()
# printActions(actions)
# printGotos(gotos)
except Exception as ex:
print(ex)
sys.exit(1)
# parse the code
try:
tree = parse(input, grammar, actions, gotos)
print("Input is syntactically correct!")
print("Parse Tree:")
tree.print("")
except Exception as ex:
print(ex)
sys.exit(1)
P -> int main ( ) { D S }
D -> D'
D' -> D' D
D' -> T id ;
D' -> T id D'' ;
D' -> T id [ il ] D'' ;
D'' -> , id
D'' -> , id D''
D'' -> , id [ il ]
D'' -> , id [ il ] D''
S -> S'
S -> S' S
S' -> A
S' -> X'
S' -> X''
S' -> { S }
A -> id = E ;
A -> id [ E ] = E ;
E -> C
E -> C E'
E' -> || C
E' -> || C E'
C -> U
C -> U C'
C' -> && U
C' -> && U C'
U -> R
U -> R Q R
R -> Y
R -> Y O Y
Y -> V
Y -> V Y'
Y' -> H V
Y' -> H V Y'
V -> F
V -> F V'
V' -> Z F
V' -> Z F V'
F -> id
F -> id [ E ]
F -> L
F -> ( E )
X' -> if ( E ) S
X' -> if ( E ) S else S
X'' -> while ( E ) { S }
L -> il
L -> true
L -> false
L -> FloatLit
L -> cl
Z -> *
Z -> /
H -> +
H -> -
O -> <
O -> <=
O -> >
O -> >=
Q -> ==
Q -> !=
T -> int
T -> bool
T -> float
T -> char
,1,2,3,4,5,6,30,11,7,31,8,9,10,15,16,12,13,14,32,33,34,35,25,26,23,24,19,20,21,22,17,18,27,28,29,$,P,D,D',D'',S,S',A,E,E',C,C',U,R,Y,Y',V,V',F,X',X'',L,Z,H,O,Q,T
0,s1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
1,,s2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
2,,,s3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
3,,,,s4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
4,,,,,s5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
5,s9,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,s10,s11,s12,,,6,7,,,,,,,,,,,,,,,,,,,,,,,8
6,,,,,s18,,s19,,,,,,,,,s20,,s21,,,,,,,,,,,,,,,,,,,,,,,13,14,15,,,,,,,,,,,,16,17,,,,,,
7,s9,,,,r1,,r1,,,,,,,,,r1,,r1,,,,,,,,,,,,,,,s10,s11,s12,,,22,7,,,,,,,,,,,,,,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,
36,,,,,,,,s57,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
37,,,,r18,,,,r18,,,r18,,,s59,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,58,,,,,,,,,,,,,,,,,
38,,,,r22,,,,r22,,,r22,,,r22,s61,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,60,,,,,,,,,,,,,,,
39,,,,r26,,,,r26,,,r26,,,r26,r26,,,,,,,,,,,,,,,,s63,s64,,,,,,,,,,,,,,,,,,,,,,,,,,,,,62,
40,,,,r28,,,,r28,,,r28,,,r28,r28,,,,,,,,,,,,s66,s67,s68,s69,r28,r28,,,,,,,,,,,,,,,,,,,,,,,,,,,,65,,
41,,,,r30,,,,r30,,,r30,,,r30,r30,,,,,,,,,,s72,s73,r30,r30,r30,r30,r30,r30,,,,,,,,,,,,,,,,,,,70,,,,,,,,71,,,
42,,,,r34,,,,r34,,,r34,,,r34,r34,,,,,,,,s76,s77,r34,r34,r34,r34,r34,r34,r34,r34,,,,,,,,,,,,,,,,,,,,,74,,,,,75,,,,
43,,,,r38,,,,r38,s78,,r38,,,r38,r38,,,,,,,,r38,r38,r38,r38,r38,r38,r38,r38,r38,r38,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
44,,,,r40,,,,r40,,,r40,,,r40,r40,,,,,,,,r40,r40,r40,r40,r40,r40,r40,r40,r40,r40,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
45,,,s45,,,,s43,,,s46,,,,,,,,,s47,s48,s49,s50,,,,,,,,,,,,,,,,,,,,,,79,,37,,38,39,40,,41,,42,,,44,,,,,
46,,,,r45,,,,r45,,,r45,,,r45,r45,,,,,,,,r45,r45,r45,r45,r45,r45,r45,r45,r45,r45,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
47,,,,r46,,,,r46,,,r46,,,r46,r46,,,,,,,,r46,r46,r46,r46,r46,r46,r46,r46,r46,r46,,,,,,,,,,,,,,,,,,,,,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,s46,,,,,,,,,s47,s48,s49,s50,,,,,,,,,,,,,,,,,,,,,,,,,,87,39,40,,41,,42,,,44,,,,,
62,,,s45,,,,s43,,,s46,,,,,,,,,s47,s48,s49,s50,,,,,,,,,,,,,,,,,,,,,,,,,,,88,40,,41,,42,,,44,,,,,
63,,,r58,,,,r58,,,r58,,,,,,,,,r58,r58,r58,r58,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
64,,,r59,,,,r59,,,r59,,,,,,,,,r59,r59,r59,r59,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
65,,,s45,,,,s43,,,s46,,,,,,,,,s47,s48,s49,s50,,,,,,,,,,,,,,,,,,,,,,,,,,,,89,,41,,42,,,44,,,,,
66,,,r54,,,,r54,,,r54,,,,,,,,,r54,r54,r54,r54,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
67,,,r55,,,,r55,,,r55,,,,,,,,,r55,r55,r55,r55,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
68,,,r56,,,,r56,,,r56,,,,,,,,,r56,r56,r56,r56,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
69,,,r57,,,,r57,,,r57,,,,,,,,,r57,r57,r57,r57,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
70,,,,r31,,,,r31,,,r31,,,r31,r31,,,,,,,,,,,,r31,r31,r31,r31,r31,r31,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
71,,,s45,,,,s43,,,s46,,,,,,,,,s47,s48,s49,s50,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,90,,42,,,44,,,,,
72,,,r52,,,,r52,,,r52,,,,,,,,,r52,r52,r52,r52,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
73,,,r53,,,,r53,,,r53,,,,,,,,,r53,r53,r53,r53,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,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,,,,,,,,,,,
88,,,,r27,,,,r27,,,r27,,,r27,r27,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
89,,,,r29,,,,r29,,,r29,,,r29,r29,,,,,,,,,,,,,,,,r29,r29,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
90,,,,r32,,,,r32,,,r32,,,r32,r32,,,,,,,,,,s72,s73,r32,r32,r32,r32,r32,r32,,,,,,,,,,,,,,,,,,,101,,,,,,,,71,,,
91,,,,r36,,,,r36,,,r36,,,r36,r36,,,,,,,,s76,s77,r36,r36,r36,r36,r36,r36,r36,r36,,,,,,,,,,,,,,,,,,,,,102,,,,,75,,,,
92,,,,,,,,,,,s103,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
93,,,,r41,,,,r41,,,r41,,,r41,r41,,,,,,,,r41,r41,r41,r41,r41,r41,r41,r41,r41,r41,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
94,,,s45,,,,s43,,,s46,,,,,,,,,s47,s48,s49,s50,,,,,,,,,,,,,,,,,,,,,,104,,37,,38,39,40,,41,,42,,,44,,,,,
95,,,,,r42,r42,r42,,,,,,,,,r42,s105,r42,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
96,,,,,s18,,s19,,,,,,,,,s20,,s21,,,,,,,,,,,,,,,,,,,,,,,106,14,15,,,,,,,,,,,,16,17,,,,,,
97,,,,,,,,s107,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
98,,,,,,,,,,,s108,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
99,,,,r21,,,,r21,,,r21,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
100,,,,r25,,,,r25,,,r25,,,r25,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
101,,,,r33,,,,r33,,,r33,,,r33,r33,,,,,,,,,,,,r33,r33,r33,r33,r33,r33,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
102,,,,r37,,,,r37,,,r37,,,r37,r37,,,,,,,,,,r37,r37,r37,r37,r37,r37,r37,r37,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
103,,,,r39,,,,r39,,,r39,,,r39,r39,,,,,,,,r39,r39,r39,r39,r39,r39,r39,r39,r39,r39,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
104,,,,,,,,s109,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
105,,,,,s18,,s19,,,,,,,,,s20,,s21,,,,,,,,,,,,,,,,,,,,,,,110,14,15,,,,,,,,,,,,16,17,,,,,,
106,,,,,,s111,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
107,r5,,,,r5,,r5,,,,,,,,,r5,,r5,,,,,,,,,,,,,,,r5,r5,r5,,,,,,,,,,,,,,,,,,,,,,,,,,,
108,,,,,,,,r8,,,,s34,,,,,,,,,,,,,,,,,,,,,,,,,,,,112,,,,,,,,,,,,,,,,,,,,,,
109,,,,,r17,r17,r17,,,,,,,,,r17,r17,r17,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
110,,,,,r43,r43,r43,,,,,,,,,r43,r43,r43,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
111,,,,,r44,r44,r44,,,,,,,,,r44,r44,r44,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
112,,,,,,,,r9,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
int main() {
int abc, b5e, c;
abc = 5;
b5e = 3;
c = abc + b5e;
}
int main() {
int a[10], sum, i;
sum = 0;
i = 0;
while (i < 10) {
a[i] = i;
sum = sum + a[i];
i = i + 1;
}
}
int main() {
float a, result;
int e;
int i;
char c;
i = 1;
e = 10;
a = 2.5;
result = 1;
while (i <= e) {
result = result * a;
i = i + 1;
}
c = 'y';
}
int main() {
float a;
int e;
int i;
char c;
i = 1;
e = 10;
a = 2.5;
result = 1;
while (i < e) {
result = result * a;
}
}
int main() {
char c, d[50];
float e3, f4, g5;
int i;
i = 10;
e = 0;
f = 3.2;
g = 5.7;
while (i >= 0) {
if ( i < 5)
e3 = e3 + f4 - (g5 * i);
i = i - 1;
}
}
main() {
int abc, b5e, c;
abc = 5;
b5e = 3;
c = abc + b5e;
}
int () {
int abc, b5e, c;
abc = 5;
b5e = 3;
c = abc + b5e;
}
int main) {
int abc, b5e, c;
abc = 5;
b5e = 3;
c = abc + b5e;
}
int main( {
int abc, b5e, c;
abc = 5;
b5e = 3;
c = abc + b5e;
}
int main()
int abc, b5e, c;
abc = 5;
b5e = 3;
c = abc + b5e;
}
int main() {
int abc, b5e, c;
abc = 5;
b5e = 3;
c = abc + b5e;
int main() {
abc, b5e, c;
abc = 5;
b5e = 3;
c = abc + b5e;
}
int main() {
int abc b5e, c;
abc = 5;
b5e = 3;
c = abc + b5e;
}
int main() {
int a[10], sum, i;
sum = 0;
i = 0;
while {
a[i] = i;
sum = sum + a[i];
i = i + 1;
}
}
int main() {
int a[10], sum, i;
sum = 0;
i = 0;
while (i < 10) {
a[i] = i;
sum = sum + a[i];
= i + 1;
}
}
int main() {
int a[10], sum, i;
sum = 0;
i = 0;
while (i < 10) {
a[i] = if;
sum = sum + a[i];
i = i + 1;
}
}