The uBASIC interpreter
Find a file
Danyil Bohdan f9ea3c6e6b Implemented line indexing for faster jumps/looping.
This required adding the ability to to get and set the
tokenizer's current position pointer from outside of it with
tokenizer_pos and tokenizer_goto (c.f. tokenizer_init).
The index itself is stored as a linked list, which makes it ripe
for further optimization. It is accessed with index_* routines.
The interpreter resorts to running the old, slower jump procedure
when jumping forward (to a line that hasn't been index).

New goto test.
2013-12-22 16:51:39 +02:00
LICENSE Added file LICENSE. 2013-12-21 22:46:35 +02:00
Makefile Moved VARIABLE_TYPE to vartype.h. VARIABLE_TYPE functions. 2013-12-21 23:59:44 +02:00
README.md Update README.md 2013-09-04 23:39:58 +02:00
tests.c Implemented line indexing for faster jumps/looping. 2013-12-22 16:51:39 +02:00
tokenizer.c Implemented line indexing for faster jumps/looping. 2013-12-22 16:51:39 +02:00
tokenizer.h Implemented line indexing for faster jumps/looping. 2013-12-22 16:51:39 +02:00
ubasic.c Implemented line indexing for faster jumps/looping. 2013-12-22 16:51:39 +02:00
ubasic.h Moved VARIABLE_TYPE to vartype.h. VARIABLE_TYPE functions. 2013-12-21 23:59:44 +02:00
use-ubasic.c The uBASIC 0.1 source code 2013-09-04 23:35:28 +02:00
vartype.h Moved VARIABLE_TYPE to vartype.h. VARIABLE_TYPE functions. 2013-12-21 23:59:44 +02:00

uBASIC: a really simple BASIC interpreter

http://dunkels.com/adam/ubasic/

Written in a couple of hours, for the fun of it. Ended up being used in a bunch of places!

The (non-interactive) uBASIC interpreter supports only the most basic BASIC functionality: if/then/else, for/next, let, goto, gosub, print, and mathematical expressions. There is only support for integer variables and the variables can only have single character names. I have added an API that allows for the program that uses the uBASIC interpreter to get and set BASIC variables, so it might be possible to actually use the uBASIC code for something useful (e.g. a small scripting language for an application that has to be really small).

See the file use-ubasic.c for an example of how to use it.