Add initial typechecker for AST #2
@ -179,6 +179,9 @@ testStatementIfThenElse = TestCase $
|
|||||||
testStatementWhile = TestCase $
|
testStatementWhile = TestCase $
|
||||||
assertEqual "expect while" [While (Reference "a") (Block [Block []])] $
|
assertEqual "expect while" [While (Reference "a") (Block [Block []])] $
|
||||||
parseStatement [WHILE,LBRACE,IDENTIFIER "a",RBRACE,LBRACKET,RBRACKET]
|
parseStatement [WHILE,LBRACE,IDENTIFIER "a",RBRACE,LBRACKET,RBRACKET]
|
||||||
|
testStatementAssign = TestCase $
|
||||||
|
assertEqual "expect assign 5" [StatementExpressionStatement (Assignment (Reference "a") (IntegerLiteral 5))] $
|
||||||
|
parseStatement [IDENTIFIER "a",ASSIGN,INTEGERLITERAL 5,SEMICOLON]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -233,5 +236,6 @@ tests = TestList [
|
|||||||
testExpressionPrecedence,
|
testExpressionPrecedence,
|
||||||
testStatementIfThen,
|
testStatementIfThen,
|
||||||
testStatementIfThenElse,
|
testStatementIfThenElse,
|
||||||
testStatementWhile
|
testStatementWhile,
|
||||||
|
testStatementAssign
|
||||||
]
|
]
|
Loading…
Reference in New Issue
Block a user