https://github.com/cvhariharan/tiny-basic
A tiny and basic TINY-BASIC interpreter
https://github.com/cvhariharan/tiny-basic
basic interpreter tiny tiny-basic
Last synced: 6 months ago
JSON representation
A tiny and basic TINY-BASIC interpreter
- Host: GitHub
- URL: https://github.com/cvhariharan/tiny-basic
- Owner: cvhariharan
- License: mit
- Created: 2019-12-20T03:42:28.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-05-15T16:33:47.000Z (about 4 years ago)
- Last Synced: 2023-08-01T14:01:27.483Z (almost 2 years ago)
- Topics: basic, interpreter, tiny, tiny-basic
- Language: C
- Homepage:
- Size: 66.4 KB
- Stars: 32
- Watchers: 2
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Tiny Basic Interpreter
A tiny basic interpreter in C. Does not follow the exact language spec as I could not find a standard spec. Still a **WIP**. You can read about the intepreter [here](https://blog.trieoflogs.com/tiny-basic/)- [x] Implement the grammar (some commands omitted)
- [x] Comments
- [ ] Error reporting```sh
build/tbc examples/fibonacci.tb
```### Example Programs
**Fibonacci**
```basic
REM This code prints n fibonacci numbers
LET a = 0
LET b = 1
LET n = 10REM This is how loops work for now
100 PRINT a
IF n == 0 THEN END
LET t = b
LET b = a + b
LET a = t
LET n = n - 1
GOTO 100
```
**Gimme some stars**
```basic
PRINT "How many stars do you want?"
LET stars = 0
INPUT stars
10 IF stars == 0 THEN END
PRINT "*"
LET stars = stars - 1
GOTO 10
```