Skip to content

mniedziolka/xd-lang

Repository files navigation

xd-lang

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.

Licence

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.

Running

Machine with stack

stack build
stack run xd-lang prog.xd

Implemented features

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)

Examples

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.

Inspirations

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:

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published