# pascal-interpreter

> A lightweight interpreter for Pascal written in JavaScript

Latest version **1.0.6** (published 2018-04-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install pascal-interpreter
pnpm add pascal-interpreter
yarn add pascal-interpreter
bun add pascal-interpreter
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2018-04-23 |
| First published | 2018-04-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 34.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Grayson Dubois @MellowCobra |
| Maintainers | mellow.cobra |
| Keywords | interpreter, pascal |

## Links

- npm: https://www.npmjs.com/package/pascal-interpreter
- Repository: https://github.com/MellowCobra/JS-Pascal-Interpreter
- Homepage: https://github.com/MellowCobra/JS-Pascal-Interpreter#readme
- Issues: https://github.com/MellowCobra/JS-Pascal-Interpreter/issues
- npm.io page: https://npm.io/package/pascal-interpreter

## Recent versions

- 1.0.6 (latest) — 2018-04-23
- 1.0.5 — 2018-04-23
- 1.0.4 — 2018-04-20
- 1.0.3 — 2018-04-18
- 1.0.2 — 2018-04-15
- 1.0.1 — 2018-04-14
- 1.0.0 — 2018-04-13

## README

# JS Pascal Interpreter
> Lightweight interpreter for Pascal written in JavaScript

WIP: Currently processes simple programs according to the grammar defined in [CFG.md](https://github.com/MellowCobra/JS-Pascal-Interpreter/blob/master/CFG.md)

This Interpreter was built as a learning exercise following Ruslan Spivak's [Let's Build a Simple Interpreter](https://ruslanspivak.com/lsbasi-part1/) series.

`repl.js` runs a basic REPL that can take simple programs on a single line, and parse and interpret them.

`main.js` takes the relative path of the program input file as a command-line argument, and parses and interprets it.

Upon a successful parsing, the constructed AST of the program is printed out, followed by the end contents of the Symbol Table, and the GLOBAL_SCOPE of the interpreter.

Most errors are caught by the lexer and the parser. Feel free to open up an issue if you find some errors that I do not report accurately.

## Installation
* Install using npm: `npm install --global pascal-interpreter`
* Alias the interpreter: `alias pascaljs="node /path/to/global/node_modules/pascal-interpreter/main.js"`
* Alias the REPL: `alias pascaljs-repl="node /path/to/global/node_modules/pascal-interpreter/repl.js"`
> Note: the path to the global node modules will be printed to the console after running the install

## Usage:
### If in the source directory:
* Run the REPL with `node repl.js`
* Ask the REPL what it can do with `help`.
* Exit the REPL with `quit`

Or
* Interpret a .pas program file with `node main.js <filename.pas>`
### If aliased:
* Run the REPL with `pascaljs-repl`
* Interpret a .pas program file with `pascaljs <filename.pas>`

---
_Source: https://npm.io/package/pascal-interpreter · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
