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.
30 lines
537 B
CMake
30 lines
537 B
CMake
cmake_minimum_required(VERSION 3.10)
|
|
project(gwbasic C)
|
|
|
|
set(CMAKE_C_STANDARD 11)
|
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
|
|
|
# Warnings
|
|
add_compile_options(-Wall -Wextra -Wno-unused-parameter)
|
|
|
|
# Include paths
|
|
include_directories(include)
|
|
|
|
# Source files
|
|
set(SOURCES
|
|
src/main.c
|
|
src/tokens.c
|
|
src/tokenizer.c
|
|
src/error.c
|
|
src/eval.c
|
|
src/math_int.c
|
|
src/math_float.c
|
|
src/math_transcend.c
|
|
src/strings.c
|
|
src/print.c
|
|
platform/hal_posix.c
|
|
)
|
|
|
|
add_executable(gwbasic ${SOURCES})
|
|
target_link_libraries(gwbasic m)
|