Skip to content
The uBASIC interpreter
C C++ Other
Branch: master
Clone or download
Pull request Compare This branch is 1 commit ahead of adamdunkels:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Initial version Feb 3, 2020
LICENSE Added file LICENSE. Dec 21, 2013
Makefile New instructions PEEK and POKE to call outside routines. Dec 23, 2013
README.md
sample.bas Initial version Feb 3, 2020
tests.c New instructions PEEK and POKE to call outside routines. Dec 23, 2013
tokenizer.c
tokenizer.h
ubasic.c Slight code style fix Jul 16, 2014
ubasic.h New instructions PEEK and POKE to call outside routines. Dec 23, 2013
use-ubasic.c
vartype.h Moved VARIABLE_TYPE to vartype.h. VARIABLE_TYPE functions. Dec 21, 2013

README.md

uBASIC: a really simple BASIC interpreter

Forked to build a WASI (WAPM) module for this. Modified use-ubasic.c

WASI steps

wasicc tokenizer.c ubasic.c use-ubasic.c -o basic.wasm

Run with wasirun:

wasirun basic.wasm sample.bas

Original documentation

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.

You can’t perform that action at this time.