Bytecode-compiled line-number BASIC interpreter with HTTP, KV, and environment variable support.
- Pipeline: Source -> Tokenizer -> Parser -> Compiler -> Bytecode -> Stack VM
f64numbers and string variables ($suffix); comparisons return -1 (true) or 0 (false)- Statements:
LET,PRINT,INPUT,IF/THEN,GOTO,GOSUB/RETURN,FOR/TO/STEP/NEXT,END,REM,HTTPHEADER - 16 built-in functions:
ABS,INT,RND,LEN,LEFT$,RIGHT$,MID$,STR$,VAL,CHR$,ASC,INSTR,KVGET$,KVSET,KVDEL,ENV$ - HTTP outbound via coroutine/yield:
HTTPGET$("url"),HTTPPOST$("url", "body"),ENV$("KEY") - Custom HTTP headers:
HTTPHEADER name$, value$(set before next HTTP request, auto-cleared after use) - KV storage via coroutine/yield:
KVGET$("key"),KVSET("key", "value"),KVDEL("key") - Multiple statements per line with
:, case-insensitive keywords, xorshift64 PRNG - Default instruction limit: 10,000,000 (configurable via
with_instruction_limit())
cargo install --path .
# Inline code
basic '10 PRINT "Hello, World!"'
# From file
basic -f program.bas
# Piped input (for INPUT statements)
echo "42" | basic '10 INPUT A : 20 PRINT A * 2'use otherfunc_basic::BasicInterpreter;
use otherfunc_core::Interpreter;
let mut basic = BasicInterpreter::new();
let output = basic.execute("10 PRINT 3 + 4", "").unwrap();
assert_eq!(output, "7\n");cargo test -p otherfunc-basic # 38 tests