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,19 @@
|
||||
PRINT "Arithmetic:"
|
||||
PRINT 2+2
|
||||
PRINT 10-3
|
||||
PRINT 6*7
|
||||
PRINT 100/3
|
||||
PRINT 2^10
|
||||
PRINT 17 MOD 5
|
||||
PRINT 17\5
|
||||
PRINT "Functions:"
|
||||
PRINT SIN(3.14159/2)
|
||||
PRINT COS(0)
|
||||
PRINT SQR(144)
|
||||
PRINT ABS(-42)
|
||||
PRINT INT(3.7)
|
||||
PRINT FIX(-3.7)
|
||||
PRINT LOG(1)
|
||||
PRINT EXP(0)
|
||||
PRINT SGN(-5)
|
||||
PRINT ATN(1)*4
|
||||
Reference in New Issue
Block a user