Littlebasic
A toy BASIC language in Java
Install / Use
/learn @mateiw/LittlebasicREADME
LittleBasic
A toy BASIC-like language implemented using Antlr4 and Java.
It's just an excuse to play with Antlr and language creation. It's small and simple but it has most constructs used in structured programming.
Syntax
Check the grammar file src/main/antlr4/basic/LittleBasic.g4 and the test files src/test/resources/*.bas
Example:
REM Greatest common divisor
INPUT "A=" ain
INPUT "B=" bin
a = VAL(ain)
b = VAL(bin)
WHILE b > 0
t = a MOD b
a = b
b = t
END
PRINT "GCD=" + a
Output:
A= 36
B= 27
GCD=9
Building
It's built with Maven, so simply execute this in the project directory:
mvn install
You'll find the jar in the /target directory.
Running
In the console:
java -jar LittleBasic.jar /path/to/MyAwesomeProgram.bas
Limitations/TODO
- Limited data types - only integers and strings
- No functions and subroutines
- Variables have global scope only
- No file I/O
- Only a few built-in functions
- No support for drawing
- No interactive mode
Enjoy!
Related Skills
node-connect
339.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
83.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
339.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
83.9kCommit, push, and open a PR
