Repository navigation
v2.0.0
Changes
- Add yahac, a Yahalang-to-C compiler written in Yahalang.
- Compile Yahalang programs into standalone native executables through a C compiler.
- Automatically detect Korean, English, and Japanese source spellings.
- Support self-compilation, with byte-identical C output from the interpreted and native compilers.
- Handle output failures consistently with the interpreter, including closed stdout pipes.
- Add compiler regression tests and strengthen compile-error checks.
- Update all three README guides with compilation and self-compilation instructions.
- Fix compiler tests on Windows checkouts using CRLF line endings.
Compile a program
From a source checkout, generate C code and build an executable:
cargo run --release -- run compiler/yahac.yaha --lang ko < examples/countdown.yaha > countdown.c
cc -O2 -o countdown countdown.c
./countdownOutput:
321
yahac reads source code from stdin and writes C code to stdout. The generated program includes the C runtime and runs independently of the Yahalang interpreter.
Korean, English, and Japanese source spellings are detected automatically. Each program must use one spelling consistently.
Self-compilation
yahac can compile itself:
cargo run --release -- run compiler/yahac.yaha --lang ko < compiler/yahac.yaha > yahac.c
cc -O1 -o yahac yahac.cThe resulting native compiler can compile other programs:
./yahac < examples/countdown.yaha > countdown.c
cc -O2 -o countdown countdown.c
./countdownIt also reproduces its own C source:
./yahac < compiler/yahac.yaha > yahac-again.c
cmp yahac.c yahac-again.cThese commands assume a Unix-like shell and a C compiler available as cc.
Error handling and validation
Compiled programs check integer overflow, UTF-8 input/output, and runtime errors. Output failures report haa? haa? and exit with status 1, including when stdout is connected to a closed pipe.
Compile-error tests now verify the expected exit status and diagnostic instead of accepting unexpected compiler failures.
Validation includes:
- 104 Rust tests and 15 compiler regression tests.
- Two 80-case differential test runs using the interpreted and native compilers.
- Self-compilation and identical C output across Korean, English, and Japanese compiler variants.
- Additional checks for representative programs, input limits, and closed stdout pipes.
The interpreter's --trace option remains available for debugging Yahalang source. Generated executables do not provide execution tracing.
Thanks
Thanks to @kohandy1902 for contributing the self-hosted compiler in #2, the project's first external contribution.
Existing programs remain compatible. No language syntax changes are introduced.
Full Changelog: v1.10.0...v2.0.0