aboutsummaryrefslogtreecommitdiff
path: root/projects/10/Square/Square.ast
blob: d360f5f14ecf83b1400247d0bafaf2f0fc3a25d3 (plain) (blame)
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 (JKeywordConst "this"))]),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") [JKeywordConst "true"]),JDoStatement (JSubroutineCall "Screen" (Just "drawRectangle") [JExpVar (JVarId "x" Nothing),JExpVar (JVarId "y" Nothing),JExpBin (JExpVar (JVarId "x" Nothing)) [('+',JExpVar (JVarId "size" Nothing))],JExpBin (JExpVar (JVarId "y" Nothing)) [('+',JExpVar (JVarId "size" Nothing))]]),JReturnStatement Nothing]),JSubroutineDec (JSubroutineHeader "method" ("void","erase") []) (JSubroutineBody [] [JDoStatement (JSubroutineCall "Screen" (Just "setColor") [JKeywordConst "false"]),JDoStatement (JSubroutineCall "Screen" (Just "drawRectangle") [JExpVar (JVarId "x" Nothing),JExpVar (JVarId "y" Nothing),JExpBin (JExpVar (JVarId "x" Nothing)) [('+',JExpVar (JVarId "size" Nothing))],JExpBin (JExpVar (JVarId "y" Nothing)) [('+',JExpVar (JVarId "size" Nothing))]]),JReturnStatement Nothing]),JSubroutineDec (JSubroutineHeader "method" ("void","incSize") []) (JSubroutineBody [] [JIfStatement (JExpBin (JExpBin (JExpBin (JExpVar (JVarId "y" Nothing)) [('+',JExpVar (JVarId "size" Nothing))]) [('<',JIntConst 254)]) [('&',JExpBin (JExpBin (JExpVar (JVarId "x" Nothing)) [('+',JExpVar (JVarId "size" Nothing))]) [('<',JIntConst 510)])]) [JDoStatement (JSubroutineCall "erase" Nothing []),JLetStatment (JVarId "size" Nothing) (JExpBin (JExpVar (JVarId "size" Nothing)) [('+',JIntConst 2)]),JDoStatement (JSubroutineCall "draw" Nothing [])] Nothing,JReturnStatement Nothing]),JSubroutineDec (JSubroutineHeader "method" ("void","decSize") []) (JSubroutineBody [] [JIfStatement (JExpBin (JExpVar (JVarId "size" Nothing)) [('>',JIntConst 2)]) [JDoStatement (JSubroutineCall "erase" Nothing []),JLetStatment (JVarId "size" Nothing) (JExpBin (JExpVar (JVarId "size" Nothing)) [('-',JIntConst 2)]),JDoStatement (JSubroutineCall "draw" Nothing [])] Nothing,JReturnStatement Nothing]),JSubroutineDec (JSubroutineHeader "method" ("void","moveUp") []) (JSubroutineBody [] [JIfStatement (JExpBin (JExpVar (JVarId "y" Nothing)) [('>',JIntConst 1)]) [JDoStatement (JSubroutineCall "Screen" (Just "setColor") [JKeywordConst "false"]),JDoStatement (JSubroutineCall "Screen" (Just "drawRectangle") [JExpVar (JVarId "x" Nothing),JExpBin (JExpBin (JExpVar (JVarId "y" Nothing)) [('+',JExpVar (JVarId "size" Nothing))]) [('-',JIntConst 1)],JExpBin (JExpVar (JVarId "x" Nothing)) [('+',JExpVar (JVarId "size" Nothing))],JExpBin (JExpVar (JVarId "y" Nothing)) [('+',JExpVar (JVarId "size" Nothing))]]),JLetStatment (JVarId "y" Nothing) (JExpBin (JExpVar (JVarId "y" Nothing)) [('-',JIntConst 2)]),JDoStatement (JSubroutineCall "Screen" (Just "setColor") [JKeywordConst "true"]),JDoStatement (JSubroutineCall "Screen" (Just "drawRectangle") [JExpVar (JVarId "x" Nothing),JExpVar (JVarId "y" Nothing),JExpBin (JExpVar (JVarId "x" Nothing)) [('+',JExpVar (JVarId "size" Nothing))],JExpBin (JExpVar (JVarId "y" Nothing)) [('+',JIntConst 1)]])] Nothing,JReturnStatement Nothing]),JSubroutineDec (JSubroutineHeader "method" ("void","moveDown") []) (JSubroutineBody [] [JIfStatement (JExpBin (JExpBin (JExpVar (JVarId "y" Nothing)) [('+',JExpVar (JVarId "size" Nothing))]) [('<',JIntConst 254)]) [JDoStatement (JSubroutineCall "Screen" (Just "setColor") [JKeywordConst "false"]),JDoStatement (JSubroutineCall "Screen" (Just "drawRectangle") [JExpVar (JVarId "x" Nothing),JExpVar (JVarId "y" Nothing),JExpBin (JExpVar (JVarId "x" Nothing)) [('+',JExpVar (JVarId "size" Nothing))],JExpBin (JExpVar (JVarId "y" Nothing)) [('+',JIntConst 1)]]),JLetStatment (JVarId "y" Nothing) (JExpBin (JExpVar (JVarId "y" Nothing)) [('+',JIntConst 2)]),JDoStatement (JSubroutineCall "Screen" (Just "setColor") [JKeywordConst "true"]),JDoStatement (JSubroutineCall "Screen" (Just "drawRectangle") [JExpVar (JVarId "x" Nothing),JExpBin (JExpBin (JExpVar (JVarId "y" Nothing)) [('+',JExpVar (JVarId "size" Nothing))]) [('-',JIntConst 1)],JExpBin (JExpVar (JVarId "x" Nothing)) [('+',JExpVar (JVarId "size" Nothing))],JExpBin (JExpVar (JVarId "y" Nothing)) [('+',JExpVar (JVarId "size" Nothing))]])] Nothing,JReturnStatement Nothing]),JSubroutineDec (JSubroutineHeader "method" ("void","moveLeft") []) (JSubroutineBody [] [JIfStatement (JExpBin (JExpVar (JVarId "x" Nothing)) [('>',JIntConst 1)]) [JDoStatement (JSubroutineCall "Screen" (Just "setColor") [JKeywordConst "false"]),JDoStatement (JSubroutineCall "Screen" (Just "drawRectangle") [JExpBin (JExpBin (JExpVar (JVarId "x" Nothing)) [('+',JExpVar (JVarId "size" Nothing))]) [('-',JIntConst 1)],JExpVar (JVarId "y" Nothing),JExpBin (JExpVar (JVarId "x" Nothing)) [('+',JExpVar (JVarId "size" Nothing))],JExpBin (JExpVar (JVarId "y" Nothing)) [('+',JExpVar (JVarId "size" Nothing))]]),JLetStatment (JVarId "x" Nothing) (JExpBin (JExpVar (JVarId "x" Nothing)) [('-',JIntConst 2)]),JDoStatement (JSubroutineCall "Screen" (Just "setColor") [JKeywordConst "true"]),JDoStatement (JSubroutineCall "Screen" (Just "drawRectangle") [JExpVar (JVarId "x" Nothing),JExpVar (JVarId "y" Nothing),JExpBin (JExpVar (JVarId "x" Nothing)) [('+',JIntConst 1)],JExpBin (JExpVar (JVarId "y" Nothing)) [('+',JExpVar (JVarId "size" Nothing))]])] Nothing,JReturnStatement Nothing]),JSubroutineDec (JSubroutineHeader "method" ("void","moveRight") []) (JSubroutineBody [] [JIfStatement (JExpBin (JExpBin (JExpVar (JVarId "x" Nothing)) [('+',JExpVar (JVarId "size" Nothing))]) [('<',JIntConst 510)]) [JDoStatement (JSubroutineCall "Screen" (Just "setColor") [JKeywordConst "false"]),JDoStatement (JSubroutineCall "Screen" (Just "drawRectangle") [JExpVar (JVarId "x" Nothing),JExpVar (JVarId "y" Nothing),JExpBin (JExpVar (JVarId "x" Nothing)) [('+',JIntConst 1)],JExpBin (JExpVar (JVarId "y" Nothing)) [('+',JExpVar (JVarId "size" Nothing))]]),JLetStatment (JVarId "x" Nothing) (JExpBin (JExpVar (JVarId "x" Nothing)) [('+',JIntConst 2)]),JDoStatement (JSubroutineCall "Screen" (Just "setColor") [JKeywordConst "true"]),JDoStatement (JSubroutineCall "Screen" (Just "drawRectangle") [JExpBin (JExpBin (JExpVar (JVarId "x" Nothing)) [('+',JExpVar (JVarId "size" Nothing))]) [('-',JIntConst 1)],JExpVar (JVarId "y" Nothing),JExpBin (JExpVar (JVarId "x" Nothing)) [('+',JExpVar (JVarId "size" Nothing))],JExpBin (JExpVar (JVarId "y" Nothing)) [('+',JExpVar (JVarId "size" Nothing))]])] Nothing,JReturnStatement Nothing])])