# IMP Interpreter A small interpreter of the IMP programming language. ## Build - `make all` to build interpreter. - `make repl` to run repl. - `make example` to interpret "example/example.imp". - `make clean` to remove build folder. ## Dependencies - [flex](https://github.com/westes/flex) - [bison](https://www.gnu.org/software/bison) - [readline](https://tiswww.case.edu/php/chet/readline/rltop.html) ## Resources - [Formal Methods and Functional Programming (Course Webpage), ETHZ](https://infsec.ethz.ch/education/ss2025/fmfp.html) ## IMP [Syntax](/res/syntax.ebnf) **Statement ``** Variable assignment: - ` := ` any variable not assigned, has the value 0. Local variable: - `var := in end` Control flow: - `if then else end` - `while do end` - `(; )` sequential composition, the first statement runs before the second - `skip`, nop **Expression** Arithmetic Expression ``: - `` - `` - `( + )` - `( - )` - `( + )` Boolean Expression ``: - `not ` - `( or )` - `( and )` - ` = ` - ` # ` not equals - ` < ` - ` <= ` - ` > ` - ` >= ` **Variable ``** - `[a-zA-Z][A-Za-z0-9]*` **Numeral ``** - `[0-9]+`