-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Pscal began as a Pascal interpreter and has evolved into a stack-based virtual machine with multiple language front ends, all written in C with a hand-crafted lexer, parser, bytecode compiler, and optional SDL2 and libcurl integrations. The architecture follows a classic compiler pipeline—front end, bytecode compiler, and VM—while supporting a substantial subset of Pascal through enums, records, control flow, units, and more.
- C11-compatible compiler
- CMake 3.24 or newer
- libcurl
- Optional: SDL2, SDL2_image, SDL2_ttf, SDL2_mixer
git clone <repository>
cd pscal
mkdir build && cd build
cmake .. # add -DSDL=ON to enable SDL support
makeAfter compilation, On Linux run
ctest --output-on-failure
for the regression suite, which covers both passing cases and expected failures.
On MacOS run,
cd Tests;make
- '''Pascal''' – Core language with a hand-written lexer and parser.
- '''tiny Language''' – Minimal educational compiler emitting Pscal bytecode; limited to integer arithmetic but useful for experiments.
- '''C-like''' – Compact C-style compiler supporting declarations, control flow, loops, expressions, and a REPL; built-in VM functions can be invoked directly.
Pscal expects etc and lib directories at runtime and provides built-in routines for math, strings, I/O, files, random numbers, and system utilities. Additional units ship for string utilities, Base64 encoding, geometry helpers, terminal control, DOS-style file operations, advanced math, and general system utilities.
Developers can extend the VM by adding C source files under src/ext_builtins, each registering new primitives via registerExtendedBuiltins.
Pscal is released into the public domain under The Unlicense.