aboutsummaryrefslogtreecommitdiff
path: root/projects/10/ExpressionLessSquare
diff options
context:
space:
mode:
Diffstat (limited to 'projects/10/ExpressionLessSquare')
-rw-r--r--projects/10/ExpressionLessSquare/Main.ast1
-rw-r--r--projects/10/ExpressionLessSquare/Square.ast1
-rw-r--r--projects/10/ExpressionLessSquare/SquareGame.ast1
3 files changed, 3 insertions, 0 deletions
diff --git a/projects/10/ExpressionLessSquare/Main.ast b/projects/10/ExpressionLessSquare/Main.ast
new file mode 100644
index 0000000..57a44eb
--- /dev/null
+++ b/projects/10/ExpressionLessSquare/Main.ast
@@ -0,0 +1 @@
+Right (JClass "Main" [JClassVarDec "static" ("boolean","test")] [JSubroutineDec (JSubroutineHeader "function" ("void","main") []) (JSubroutineBody [("SquareGame","game")] [JLetStatment (JVarId "game" Nothing) (JExpVar (JVarId "game" Nothing)),JDoStatement (JSubroutineCall "game" (Just "run") []),JDoStatement (JSubroutineCall "game" (Just "dispose") []),JReturnStatement Nothing]),JSubroutineDec (JSubroutineHeader "function" ("void","test") []) (JSubroutineBody [("int","i"),("int","j"),("String","s"),("Array","a")] [JIfStatement (JExpVar (JVarId "i" Nothing)) [JLetStatment (JVarId "s" Nothing) (JExpVar (JVarId "i" Nothing)),JLetStatment (JVarId "s" Nothing) (JExpVar (JVarId "j" Nothing)),JLetStatment (JVarId "a" (Just (JExpVar (JVarId "i" Nothing)))) (JExpVar (JVarId "j" Nothing))] (Just [JLetStatment (JVarId "i" Nothing) (JExpVar (JVarId "i" Nothing)),JLetStatment (JVarId "j" Nothing) (JExpVar (JVarId "j" Nothing)),JLetStatment (JVarId "i" Nothing) (JExpBin (JExpVar (JVarId "i" Nothing)) [('|',JExpVar (JVarId "j" Nothing))])]),JReturnStatement Nothing])]) \ No newline at end of file
diff --git a/projects/10/ExpressionLessSquare/Square.ast b/projects/10/ExpressionLessSquare/Square.ast
new file mode 100644
index 0000000..884c695
--- /dev/null
+++ b/projects/10/ExpressionLessSquare/Square.ast
@@ -0,0 +1 @@
+Right (JClass "Square" [JClassVarDec "field" ("int","x"),JClassVarDec "field" ("int","y"),JClassVarDec "field" ("int","size")] [JSubroutineDec (JSubroutineHeader "constructor" ("Square","new") [("int","Ax"),("int","Ay"),("int","Asize")]) (JSubroutineBody [] [JLetStatment (JVarId "x" Nothing) (JExpVar (JVarId "Ax" Nothing)),JLetStatment (JVarId "y" Nothing) (JExpVar (JVarId "Ay" Nothing)),JLetStatment (JVarId "size" Nothing) (JExpVar (JVarId "Asize" Nothing)),JDoStatement (JSubroutineCall "draw" Nothing []),JReturnStatement (Just (JExpVar (JVarId "x" Nothing)))]),JSubroutineDec (JSubroutineHeader "method" ("void","dispose") []) (JSubroutineBody [] [JDoStatement (JSubroutineCall "Memory" (Just "deAlloc") [JKeywordConst "this"]),JReturnStatement Nothing]),JSubroutineDec (JSubroutineHeader "method" ("void","draw") []) (JSubroutineBody [] [JDoStatement (JSubroutineCall "Screen" (Just "setColor") [JExpVar (JVarId "x" Nothing)]),JDoStatement (JSubroutineCall "Screen" (Just "drawRectangle") [JExpVar (JVarId "x" Nothing),JExpVar (JVarId "y" Nothing),JExpVar (JVarId "x" Nothing),JExpVar (JVarId "y" Nothing)]),JReturnStatement Nothing]),JSubroutineDec (JSubroutineHeader "method" ("void","erase") []) (JSubroutineBody [] [JDoStatement (JSubroutineCall "Screen" (Just "setColor") [JExpVar (JVarId "x" Nothing)]),JDoStatement (JSubroutineCall "Screen" (Just "drawRectangle") [JExpVar (JVarId "x" Nothing),JExpVar (JVarId "y" Nothing),JExpVar (JVarId "x" Nothing),JExpVar (JVarId "y" Nothing)]),JReturnStatement Nothing]),JSubroutineDec (JSubroutineHeader "method" ("void","incSize") []) (JSubroutineBody [] [JIfStatement (JExpVar (JVarId "x" Nothing)) [JDoStatement (JSubroutineCall "erase" Nothing []),JLetStatment (JVarId "size" Nothing) (JExpVar (JVarId "size" Nothing)),JDoStatement (JSubroutineCall "draw" Nothing [])] Nothing,JReturnStatement Nothing]),JSubroutineDec (JSubroutineHeader "method" ("void","decSize") []) (JSubroutineBody [] [JIfStatement (JExpVar (JVarId "size" Nothing)) [JDoStatement (JSubroutineCall "erase" Nothing []),JLetStatment (JVarId "size" Nothing) (JExpVar (JVarId "size" Nothing)),JDoStatement (JSubroutineCall "draw" Nothing [])] Nothing,JReturnStatement Nothing]),JSubroutineDec (JSubroutineHeader "method" ("void","moveUp") []) (JSubroutineBody [] [JIfStatement (JExpVar (JVarId "y" Nothing)) [JDoStatement (JSubroutineCall "Screen" (Just "setColor") [JExpVar (JVarId "x" Nothing)]),JDoStatement (JSubroutineCall "Screen" (Just "drawRectangle") [JExpVar (JVarId "x" Nothing),JExpVar (JVarId "y" Nothing),JExpVar (JVarId "x" Nothing),JExpVar (JVarId "y" Nothing)]),JLetStatment (JVarId "y" Nothing) (JExpVar (JVarId "y" Nothing)),JDoStatement (JSubroutineCall "Screen" (Just "setColor") [JExpVar (JVarId "x" Nothing)]),JDoStatement (JSubroutineCall "Screen" (Just "drawRectangle") [JExpVar (JVarId "x" Nothing),JExpVar (JVarId "y" Nothing),JExpVar (JVarId "x" Nothing),JExpVar (JVarId "y" Nothing)])] Nothing,JReturnStatement Nothing]),JSubroutineDec (JSubroutineHeader "method" ("void","moveDown") []) (JSubroutineBody [] [JIfStatement (JExpVar (JVarId "y" Nothing)) [JDoStatement (JSubroutineCall "Screen" (Just "setColor") [JExpVar (JVarId "x" Nothing)]),JDoStatement (JSubroutineCall "Screen" (Just "drawRectangle") [JExpVar (JVarId "x" Nothing),JExpVar (JVarId "y" Nothing),JExpVar (JVarId "x" Nothing),JExpVar (JVarId "y" Nothing)]),JLetStatment (JVarId "y" Nothing) (JExpVar (JVarId "y" Nothing)),JDoStatement (JSubroutineCall "Screen" (Just "setColor") [JExpVar (JVarId "x" Nothing)]),JDoStatement (JSubroutineCall "Screen" (Just "drawRectangle") [JExpVar (JVarId "x" Nothing),JExpVar (JVarId "y" Nothing),JExpVar (JVarId "x" Nothing),JExpVar (JVarId "y" Nothing)])] Nothing,JReturnStatement Nothing]),JSubroutineDec (JSubroutineHeader "method" ("void","moveLeft") []) (JSubroutineBody [] [JIfStatement (JExpVar (JVarId "x" Nothing)) [JDoStatement (JSubroutineCall "Screen" (Just "setColor") [JExpVar (JVarId "x" Nothing)]),JDoStatement (JSubroutineCall "Screen" (Just "drawRectangle") [JExpVar (JVarId "x" Nothing),JExpVar (JVarId "y" Nothing),JExpVar (JVarId "x" Nothing),JExpVar (JVarId "y" Nothing)]),JLetStatment (JVarId "x" Nothing) (JExpVar (JVarId "x" Nothing)),JDoStatement (JSubroutineCall "Screen" (Just "setColor") [JExpVar (JVarId "x" Nothing)]),JDoStatement (JSubroutineCall "Screen" (Just "drawRectangle") [JExpVar (JVarId "x" Nothing),JExpVar (JVarId "y" Nothing),JExpVar (JVarId "x" Nothing),JExpVar (JVarId "y" Nothing)])] Nothing,JReturnStatement Nothing]),JSubroutineDec (JSubroutineHeader "method" ("void","moveRight") []) (JSubroutineBody [] [JIfStatement (JExpVar (JVarId "x" Nothing)) [JDoStatement (JSubroutineCall "Screen" (Just "setColor") [JExpVar (JVarId "x" Nothing)]),JDoStatement (JSubroutineCall "Screen" (Just "drawRectangle") [JExpVar (JVarId "x" Nothing),JExpVar (JVarId "y" Nothing),JExpVar (JVarId "x" Nothing),JExpVar (JVarId "y" Nothing)]),JLetStatment (JVarId "x" Nothing) (JExpVar (JVarId "x" Nothing)),JDoStatement (JSubroutineCall "Screen" (Just "setColor") [JExpVar (JVarId "x" Nothing)]),JDoStatement (JSubroutineCall "Screen" (Just "drawRectangle") [JExpVar (JVarId "x" Nothing),JExpVar (JVarId "y" Nothing),JExpVar (JVarId "x" Nothing),JExpVar (JVarId "y" Nothing)])] Nothing,JReturnStatement Nothing])]) \ No newline at end of file
diff --git a/projects/10/ExpressionLessSquare/SquareGame.ast b/projects/10/ExpressionLessSquare/SquareGame.ast
new file mode 100644
index 0000000..0abe80b
--- /dev/null
+++ b/projects/10/ExpressionLessSquare/SquareGame.ast
@@ -0,0 +1 @@
+Right (JClass "SquareGame" [JClassVarDec "field" ("Square","square"),JClassVarDec "field" ("int","direction")] [JSubroutineDec (JSubroutineHeader "constructor" ("SquareGame","new") []) (JSubroutineBody [] [JLetStatment (JVarId "square" Nothing) (JExpVar (JVarId "square" Nothing)),JLetStatment (JVarId "direction" Nothing) (JExpVar (JVarId "direction" Nothing)),JReturnStatement (Just (JExpVar (JVarId "square" Nothing)))]),JSubroutineDec (JSubroutineHeader "method" ("void","dispose") []) (JSubroutineBody [] [JDoStatement (JSubroutineCall "square" (Just "dispose") []),JDoStatement (JSubroutineCall "Memory" (Just "deAlloc") [JExpVar (JVarId "square" Nothing)]),JReturnStatement Nothing]),JSubroutineDec (JSubroutineHeader "method" ("void","moveSquare") []) (JSubroutineBody [] [JIfStatement (JExpVar (JVarId "direction" Nothing)) [JDoStatement (JSubroutineCall "square" (Just "moveUp") [])] Nothing,JIfStatement (JExpVar (JVarId "direction" Nothing)) [JDoStatement (JSubroutineCall "square" (Just "moveDown") [])] Nothing,JIfStatement (JExpVar (JVarId "direction" Nothing)) [JDoStatement (JSubroutineCall "square" (Just "moveLeft") [])] Nothing,JIfStatement (JExpVar (JVarId "direction" Nothing)) [JDoStatement (JSubroutineCall "square" (Just "moveRight") [])] Nothing,JDoStatement (JSubroutineCall "Sys" (Just "wait") [JExpVar (JVarId "direction" Nothing)]),JReturnStatement Nothing]),JSubroutineDec (JSubroutineHeader "method" ("void","run") []) (JSubroutineBody [("char","key"),("boolean","exit")] [JLetStatment (JVarId "exit" Nothing) (JExpVar (JVarId "key" Nothing)),JWhileStatment (JExpVar (JVarId "exit" Nothing)) [JWhileStatment (JExpVar (JVarId "key" Nothing)) [JLetStatment (JVarId "key" Nothing) (JExpVar (JVarId "key" Nothing)),JDoStatement (JSubroutineCall "moveSquare" Nothing [])],JIfStatement (JExpVar (JVarId "key" Nothing)) [JLetStatment (JVarId "exit" Nothing) (JExpVar (JVarId "exit" Nothing))] Nothing,JIfStatement (JExpVar (JVarId "key" Nothing)) [JDoStatement (JSubroutineCall "square" (Just "decSize") [])] Nothing,JIfStatement (JExpVar (JVarId "key" Nothing)) [JDoStatement (JSubroutineCall "square" (Just "incSize") [])] Nothing,JIfStatement (JExpVar (JVarId "key" Nothing)) [JLetStatment (JVarId "direction" Nothing) (JExpVar (JVarId "exit" Nothing))] Nothing,JIfStatement (JExpVar (JVarId "key" Nothing)) [JLetStatment (JVarId "direction" Nothing) (JExpVar (JVarId "key" Nothing))] Nothing,JIfStatement (JExpVar (JVarId "key" Nothing)) [JLetStatment (JVarId "direction" Nothing) (JExpVar (JVarId "square" Nothing))] Nothing,JIfStatement (JExpVar (JVarId "key" Nothing)) [JLetStatment (JVarId "direction" Nothing) (JExpVar (JVarId "direction" Nothing))] Nothing,JWhileStatment (JExpVar (JVarId "key" Nothing)) [JLetStatment (JVarId "key" Nothing) (JExpVar (JVarId "key" Nothing)),JDoStatement (JSubroutineCall "moveSquare" Nothing [])]],JReturnStatement Nothing])]) \ No newline at end of file