Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lostintangent/basic-interpreter
A simple interpreter for Microsoft BASIC
https://github.com/lostintangent/basic-interpreter
Last synced: 4 days ago
JSON representation
A simple interpreter for Microsoft BASIC
- Host: GitHub
- URL: https://github.com/lostintangent/basic-interpreter
- Owner: lostintangent
- Created: 2024-05-01T23:06:34.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-05-01T23:06:36.000Z (7 months ago)
- Last Synced: 2024-10-17T06:56:14.549Z (27 days ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Simple BASIC Interpreter
This repository now contains a Node.js project that implements a simple interpreter for BASIC. The interpreter supports executing BASIC programs from a file path provided by the user, interpreting line number prefixed instructions correctly. It supports the following instructions:
- `LET` - Assigns the value of a variable. The assignment expression can be an arbitrary expression that includes variables.
- `PRINT` - Prints a variable or a string constant.
- `IF...THEN` - Evaluates an if expression and then allows printing or goto in the then statement.
- `GOTO` - Jumps to the specified line.
- `END` - Ends the program.## Running the Interpreter
To run the interpreter with a BASIC program file, use the following command:
```bash
node interpreter.js
```For example, to execute a sample program, you would run:
```bash
node interpreter.js sample.bas
```A sample script (`sample.bas`) is included in the repository to demonstrate simple examples of the supported instructions.