Add initial typechecker for AST #2

Merged
mrab merged 121 commits from typedAST into master 2024-06-14 07:53:30 +00:00
Showing only changes of commit c347e6c630 - Show all commits

View File

@ -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
] ]