Phase 1: expression calculator with direct mode
GW-BASIC reimplementation in C11, using Microsoft's open-sourced 8088 assembly as the authoritative reference. Tokenizer (CRUNCH/LIST), expression evaluator with operator precedence, all math functions (SIN, COS, TAN, ATN, SQR, LOG, EXP, RND, etc.), string functions (LEFT$, RIGHT$, MID$, CHR$, ASC, VAL, STR$, etc.), PRINT statement with comma/semicolon zones, TAB(), SPC(). Handles integer/single/double types with correct promotion, D exponent for double-precision literals, type suffixes (%, !, #), &H hex/&O octal literals, MBF conversion routines, and GW-BASIC-compatible number formatting. Platform-independent via HAL vtable; POSIX backend included.
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
PRINT LEFT$("HELLO WORLD", 5)
|
||||
PRINT RIGHT$("HELLO WORLD", 5)
|
||||
PRINT MID$("HELLO WORLD", 7, 5)
|
||||
PRINT LEN("TEST")
|
||||
PRINT CHR$(65)
|
||||
PRINT ASC("A")
|
||||
PRINT VAL("3.14")
|
||||
PRINT STR$(42)
|
||||
PRINT SPACE$(5)+"X"
|
||||
PRINT STRING$(10, 42)
|
||||
PRINT HEX$(255)
|
||||
PRINT OCT$(255)
|
||||
PRINT INSTR("HELLO WORLD", "WORLD")
|
||||
PRINT "ABC" + "DEF"
|
||||
Reference in New Issue
Block a user