Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marcinbrojek/jpp-interpreter
An interpreter for an imperative programming language with syntax based on a subset of C/C++. The program consists of variable and function declarations. When executed, it runs the declared main function. Written in Haskell.
https://github.com/marcinbrojek/jpp-interpreter
bcnf cpp-syntax haskell interpreter tests
Last synced: 26 days ago
JSON representation
An interpreter for an imperative programming language with syntax based on a subset of C/C++. The program consists of variable and function declarations. When executed, it runs the declared main function. Written in Haskell.
- Host: GitHub
- URL: https://github.com/marcinbrojek/jpp-interpreter
- Owner: MarcinBrojek
- Created: 2024-06-29T08:23:34.000Z (4 months ago)
- Default Branch: master
- Last Pushed: 2024-07-02T10:01:29.000Z (4 months ago)
- Last Synced: 2024-10-12T23:42:40.847Z (26 days ago)
- Topics: bcnf, cpp-syntax, haskell, interpreter, tests
- Language: Haskell
- Homepage:
- Size: 44.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# jpp-interpreter
#### LANGUAGE
An imperative language with syntax based on a subset of C/C++. It has been slightly modified to fulfill specific functionalities. Programs consist of variable/function declarations. The executed program will invoke the declared main function. More syntax details can be found in the language specification: Marcin_Brojek.md.
The provided interpreter adheres to the specifications outlined in the declaration, except for the incorrect handling of the get method for tuples.
#### OVERVIEW OF THE SOLUTION
The solution comprises two main modules: **TypeChecker** and **Interpreter**, both utilizing monads concurrently: Reader, State, Except. In the TypeChecker module, environment and state store type information, while in the Interpreter module, they store values.
Within a block - a sequence of instructions - variable declarations, functions, and procedures can appear at any position. Therefore, both modules above apply subsequent instructions to newly created, successive environments.
#### EXECUTION
Compiling using the **make** command will create a `build` directory and an executable `interpreter` file, which can be run with the command
```
./interpreter program
```#### EXAMPLES
In the `bad` directory, files are named `XX-YY-name-of-test.cpp`, where **XX** equals **00** signifies syntax errors, **10** denotes runtime errors caught dynamically, and **12** indicates errors during static type checking.
Files in the `good` directory are named `YY-name-of-test.cpp`, where **YY** corresponds to a functionality number from the Imperative Language list. Except for **99**, which points to other comprehensive program examples.
To run all examples based on the directory, you can use the command
```
make good_run
```
or
```
make bad_run
```