Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jesselpalmer/basic
BASIC interpreter
https://github.com/jesselpalmer/basic
basic basic-interpreter basic-lang basic-language interpreter
Last synced: 17 days ago
JSON representation
BASIC interpreter
- Host: GitHub
- URL: https://github.com/jesselpalmer/basic
- Owner: jesselpalmer
- License: mit
- Created: 2016-06-09T13:40:00.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2023-11-12T21:18:17.000Z (about 1 year ago)
- Last Synced: 2024-10-06T10:42:01.204Z (3 months ago)
- Topics: basic, basic-interpreter, basic-lang, basic-language, interpreter
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/node-basic-lang
- Size: 1.33 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
[![npm](https://img.shields.io/npm/dw/node-basic-lang.svg)](https://www.npmjs.com/package/node-basic-lang) [![Node.js CI](https://github.com/jesselpalmer/BASIC/actions/workflows/node.js.yml/badge.svg)](https://github.com/jesselpalmer/BASIC/actions/workflows/node.js.yml)
# BASIC
BASIC interpreter
## Installation
1. You need to have at least version`v14.0.0` of [node.js](https://nodejs.org/en/) installed.
2. Install the `node-basic-lang` library globally:
```bash
npm install -g node-basic-lang
```## Executing files
1. Create a BASIC program using the [supported commands](#supported-commands) below. Make sure that the file ends in `.bas`.
2. Run the BASIC program that you created
```bash
basic .bas
```Example:
```bash
basic game.bas
```## Using the REPL
You can use the REPL just by running the following command in the terminal:
```bash
basic
```Make sure that you enter a unique line number for each command, just like you would a normal file. See [supported commands](#supported-commands) below for a list of commands you can use.
## Supported commands
`ABS` - Prints out the absolute value of a number.
`CLS` - Clears the console.
`INT` - Prints out an integer by rounding any decimal number down.
`PRINT` - Prints lines to the console.
`REM` - Comments for the user. The interpreter ignores these lines.
`END` - Exits the program.## Sample file
```bas
10 CLS
20 REM "BASIC HELLO WORLD PROGRAM"
30 PRINT "HELLO WORLD"
40 PRINT "HELLO WORLD 2X"
50 PRINT "HELLO WORLD 3X"
60 ABS "-3.14"
70 INT "1.6180"
80 END
```