A Teeny Tiny Type checker and Interpreter for WHILE++ to get some practice with
- Parser combinators
chumsky - Error handling
Result - Type checking
- Error reporting
ariadne - Property based testing
proptest
Fill in the parse_todo!() inside parse.rs to parse expressions the WHILE++ language.
-
First, complete the implementations of
parse_rel_exprandparse_expr. When you are donecargo test relationalshould work. -
Next, define and use sub-parsers like
if_onlyandtry_to parse one-armedifstatements andtrystatements. When you are donecargo test statementshould pass.
When you are done with both parts, cargo test parse should pass.
Next, fill in the todo!() inside eval.rs to evaluate WHILE++ programs.
-
First, fill in
eval_opandeval_exprto evaluate expressions. When you are done,cargo test evalshould pass -
Next, fill in
eval_stmtto evaluate statements. When you are done,cargo test runshould pass.
Finally, you will implement a small static checker for WHILE++ programs.
-
First, implement
check_exprwhich checks that anExpris well-typed in a givenEnv. When you are done,cargo test check_exprshould pass. -
Next, implement
check_stmtwhich checks that aStmtis well-typed in a givenEnv. When you are done,cargo test soundnessshould pass.
Specifically, the soundness tests check that if a program type-checks, then it will not produce a runtime type error when evaluated (divide by zero is ok).
When you are done with all the parts, cargo test check should pass.
Each test is worth 5 points; so you can run cargo test and figure out your score.
You can run python3 grade.py to do the tabulation automatically.
You can submit your assignment by running make turnin