Simple Basic Like Iterpreter.
Currently supported instructions are:
- VAR -> Declaring variable
- LABEL -> Declaring label
- GOTO -> Go to line number
- GOTOSUB -> Go to label
- IF -> Condition statement if TRUE do line + 1 else skip
- END -> Used to indicate end of the program
- RAND -> Generate random number
- INPUT -> Allows to enter a variable
- LOAD -> Load variable B to A START : STOP
- GRAPHICS -> Initialize graphics see below
- PIXEL -> Put pixel on screen
- RENDER -> Renders the screen
There are 2 build of the interpreter:
- bbasic.c This build does not suport last 3 instructions and not depends on anything except standard library
- bbbasicgraphics.c This build does suport last 3 instuction and depends on SDL
To compile it you need first to compile header libary for desired build.
-
gcc bbasic.h
-
gcc basicgraphics.h
Then compile desired build.
-
gcc bbasic.c -lm -O0
-
gcc bbbasicgraphics.c -lm -lSDL2 -lGL -O0
Then run program
-
./a.out filePathToProgram
In example folder we will fine examples of programs.
This implementation currently is 2 time slower then python in fizzbuzz test on my PC.