https://github.com/lucasmagnum/simple-interpreter
Simple interpreter for Pascal language.
https://github.com/lucasmagnum/simple-interpreter
experiment interpreter pascal-interpreter python python3
Last synced: 10 months ago
JSON representation
Simple interpreter for Pascal language.
- Host: GitHub
- URL: https://github.com/lucasmagnum/simple-interpreter
- Owner: LucasMagnum
- License: mit
- Created: 2017-07-14T13:35:59.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-29T09:35:39.000Z (almost 9 years ago)
- Last Synced: 2025-03-11T06:35:29.199Z (over 1 year ago)
- Topics: experiment, interpreter, pascal-interpreter, python, python3
- Language: Python
- Size: 43.9 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
Simple Interpreter
==================
[](https://circleci.com/gh/LucasMagnum/simple-interpreter)
[](https://codecov.io/gh/LucasMagnum/simple-interpreter)
Simple interpreter for Pascal language built using Python.
This interpreter was built following the `Let's Build a Simple Interpreter` tutorial.
This is an experiment project, the aim is have fun and learn more about compilers & interpreters.
### How to use it
This interpreter can either process a file or run in the REPL mode.
Basically, we have to follow the steps bellow:
1. Clone this repository
2. Install all dependencies (see [setup](#1-setup))
3. Process a Pascal file (see [process a file](#3-processing-a-pascal-file))
4. REPL version (see [REPL version](#4-repl))
### Table of Contents
* [1. Setup](#1-setup)
* [2. Running tests](#2-running-tests)
* [3. Processing a Pascal file](#3-processing-a-pascal-file)
* [4. REPL](#4-repl)
* [Useful links](#useful-links)
---
## Development
### 1. Setup
To properly run this interpreter, we should install the dependencies:
```bash
make setup
```
### 2. Running tests
We have two kinds of tests implemented: unit tests and behaviour tests. We can run the tests with the following commands:
```bash
make tests # Run both unit and behaviour tests
make unit-tests
make behaviour-tests
```
### 3. Processing a Pascal file
We can run the application and see the web version of this interpreter.
Just have to run the command bellow:
```bash
make run .pas
```
### 4. REPL
This interpreter also has a REPL mode that can be enable with the following command:
```bash
make run-repl
```
### Running inside docker
To run this interpreter inside docker, we have to follow the commands bellow:
1. Install docker
2. Build simple interpreter image
```bash
docker build -t simple-interpreter
```
3. Run commands using docker
```bash
docker run -i -v `pwd`:/simple-interpreter make tests
```
### Useful links
1 - [Let's build a simple interpreter](https://ruslanspivak.com/lsbasi-part1/)