In this repository you can find an interpreter for a simple imperative language called "xd". It was made for the "Programming languages and paradigms" course, which is an obligatory course at my university. Because of that you can find here many inconsistencies or even errors.
This project is released on the MIT license. Feel free to use it in any way you like. The whole license file can be found here.
stack build
stack run xd-lang prog.xd
First:
- 01 (3 types: bool, int, string)
- 02 (literals, arithmetic, comparisons)
- 03 (variables, assignments)
- 04 (print)
- 05 (while, if)
- 06 (functions, recurrence)
- 07 (passing the variable by reference or value)
Second
- 09 (shadowing and static binding)
- 10 (runtime error handling)
- 11 (functions that can return a value)
Third:
- 12 (4) (statically typed language)
- 13 (2) (nested functions with static binding)
- 16 (1) (break, continue)
You can find some examples written in this language in the examples/good directory. Their numbers are related to the list of implemented features. There are also sam bad examples available in examples/bad directory. They're mostly checking the "Typechecker" functionalities.
Some general concepts like code structure or managing the state of the program are taken from other projects. Check them out, they might be useful: