Skip to content
Snippets Groups Projects
Commit b3c96df4 authored by Nicholas Robinson's avatar Nicholas Robinson
Browse files

methodOrFieldInvocs & statement type

- added new methodOrField thing that lets you invoc methods and fields
recursively infinitely
- statement can now declare and define any type
- removed arrayID nonterminal
- adjusted arrayAccess because of arrayID removal
- added a cmd in README to make my workflow more convenient
- commented out all the many many many prints in Test.py
parent ecd5a07a
No related branches found
No related tags found
No related merge requests found
......@@ -32,10 +32,10 @@ def main():
for token in tokens:
if (token.name and token.lex):
s += '(' + token.name + ',' + token.lex + '), '
print(s)
# print(s)
# Parsing
print("Parsing starts")
# print("Parsing starts")
try:
(steps, errorString) = parse(tokens)
......@@ -48,8 +48,8 @@ def main():
print("**********************************************************")
continue
print("All Steps:")
print(steps)
# print("All Steps:")
# print(steps)
print("**********************************************************")
......
......@@ -2,3 +2,4 @@ compile Jlr1.java into it's own folder called 'jlar'
javac Jlr1.java
cat lr1GenInput.cfg | java jlalr.Jlr1
cat cs444/cfg/lr1GenInput.cfg | java jlalr.Jlr1 > cs444/cfg/trans.txt
\ No newline at end of file
......@@ -62,7 +62,7 @@ COMMA
PERIOD
COMPID
IMPORTALL
95
98
start
packageDcl
importDcls
......@@ -137,6 +137,9 @@ unqualClassCreate
unqualCreate
fieldAccess
arrayAccess
methodOrFieldInvocs
methodOrFieldInvoc
fieldInvoc
methodInvoc
literal
expr
......@@ -157,9 +160,9 @@ castExpr
postfixExpr
primaryNoArrayAccess
arrayID
methodID
methodOrFieldID
start
199
205
start BOF packageDcl importDcls topDcls EOF
packageDcl PACKAGE name SEMICO
packageDcl PACKAGE ID SEMICO
......@@ -264,7 +267,7 @@ statement ifElseStatement
statement forStatement
statement whileStatement
statement variableDcl SEMICO
statement primitiveType variableDcl SEMICO
statement type variableDcl SEMICO
noTailStatement block
noTailStatement SEMICO
noTailStatement exprStatement
......@@ -300,19 +303,23 @@ primary arrayAccess
primary primaryNoArrayAccess
primaryNoArrayAccess literal
primaryNoArrayAccess LPAREN expr RPAREN
primaryNoArrayAccess classInstanceCreate
primaryNoArrayAccess classInstanceCreate methodOrFieldInvocs
primaryNoArrayAccess fieldAccess
primaryNoArrayAccess methodInvoc
classInstanceCreate unqualCreate
unqualCreate NEW name LPAREN args RPAREN
unqualCreate NEW ID LPAREN args RPAREN
arrayAccess arrayID LSQRBRACK expr RSQRBRACK
arrayAccess name LSQRBRACK expr RSQRBRACK
arrayAccess ID LSQRBRACK expr RSQRBRACK
arrayAccess primaryNoArrayAccess LSQRBRACK expr RSQRBRACK
arrayID name
arrayID ID
methodInvoc methodID LPAREN args RPAREN
methodID ID
methodID name
methodOrFieldInvocs
methodOrFieldInvocs PERIOD methodOrFieldInvoc methodOrFieldInvocs
methodOrFieldInvoc methodInvoc
methodOrFieldInvoc fieldInvoc
fieldInvoc methodOrFieldID
methodInvoc methodOrFieldID LPAREN args RPAREN
methodOrFieldID ID
methodOrFieldID name
literal LITERALBOOL
literal LITERALCHAR
literal LITERALSTRING
......@@ -342,6 +349,8 @@ relationalExpr relationalExpr LE addExpr
relationalExpr relationalExpr GE addExpr
relationalExpr relationalExpr LT addExpr
relationalExpr relationalExpr GT addExpr
relationalExpr relationalExpr EQUAL addExpr
relationalExpr relationalExpr NE addExpr
addExpr multExpr
addExpr addExpr ADD multExpr
addExpr addExpr SUB multExpr
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment