Repository navigation
Releases
v2.1.0
Changes
- Add
--max-steps Nto file execution and the REPL. - Stop before the next instruction when the execution budget is exhausted.
- Preserve the current stack and arrays after reaching the limit.
- Report the blocked instruction through
--trace. - Document execution limits in the Korean, English, and Japanese README guides.
Execution step limits
Limit a program to 1,000 instructions:
yahalang run examples/truth_machine.yaha --lang ko --max-steps 1000 --error-style friendlyWhen the budget is exhausted and another instruction remains, execution stops with status 1. Friendly errors report:
execution step limit exceeded
Without --error-style friendly, the diagnostic is haa? haa?.
The limit counts executed instructions, including each loop condition check and loop-end instruction. Skipped code does not count. A number or array literal counts as one instruction regardless of its length.
Omitting --max-steps keeps execution unlimited. Setting it to 0 prevents any instruction from running.
REPL behavior
Each complete submission gets a fresh execution budget:
yahalang repl --lang en --max-steps 3 --error-style friendlyyaha> hayaha ppuru yaha
yaha> iya yadayada
...> ura yadayada
runtime error at line 2, instruction 1: execution step limit exceeded
yaha> :stack
[1]
yaha> :reset
yaha> hayaha ppuruppuru yaha
yaha> iiiiyaha ppururu
2
yaha> :q
The loop stops at the limit, and the REPL remains available. Existing stack values and array mutations are preserved. REPL commands such as :stack and :reset do not count toward the budget.
Tracing and scope
Combine execution limits with tracing to inspect where a program stops:
yahalang run examples/truth_machine.yaha --lang ko --max-steps 1000 --traceThe blocked instruction produces an error trace entry without being executed.
Execution limits apply to the Rust interpreter, including the REPL. They do not apply to generated C executables or limit memory usage or time spent waiting for input.
Full Changelog: v2.0.0...v2.1.0
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
v1.10.0
Changes
- Add
--traceto file execution and the REPL. - Show executed source phrases, source locations, and stack contents before and after each instruction.
- Report the current stack and error reason when an instruction fails.
- Add ten representative programs covering arithmetic, arrays, text processing, and expression evaluation.
- Reorganize the Korean, English, and Japanese README guides with consistent command tables and examples.
- Clarify stack effects, array reference sharing, EOF handling, and runtime error behavior.
- Add an example guide with input formats, sample output, and working array layouts.
Execution tracing
yahalang run examples/trace_stack.yaha --lang ko --traceThe example prints 4. Its addition produces these trace entries:
[trace] examples/trace_stack.yaha:3:1 before "야하" stack=[2, 2]
[trace] examples/trace_stack.yaha:3:1 after "야하" stack=[4]
Locations use file:line:column, starting at 1. Columns count characters rather than bytes. Multiline phrases retain their starting location, and only executed instructions are traced.
Trace entries go to stderr, keeping program output separate:
yahalang run examples/trace_stack.yaha --lang ko --trace > result.txt 2> trace.logTracing is also available in the REPL:
yahalang repl --lang en --traceREPL locations use <repl> and line numbers relative to the current submission.
Ten representative programs
| Program | File |
|---|---|
| Factorial | examples/factorial.yaha |
| Greatest common divisor | examples/gcd.yaha |
| Fibonacci sequence | examples/fibonacci.yaha |
| Primality test | examples/is_prime.yaha |
| Sum, minimum, and maximum | examples/number_stats.yaha |
| Array sorting | examples/array_sort.yaha |
| Palindrome detection | examples/palindrome.yaha |
| Character frequency | examples/character_frequency.yaha |
| Caesar cipher | examples/caesar_cipher.yaha |
| Postfix calculator | examples/postfix_calculator.yaha |
All programs use existing language commands and Korean spellings.
printf '48\n18\n' | yahalang run examples/gcd.yaha --lang koOutput: 6
printf '12 3 + 2 *\n' | yahalang run examples/postfix_calculator.yaha --lang koOutput: 30
See examples/README.md for input formats, sample runs, and algorithm explanations.
Documentation and tests
The three README guides now follow the same structure, from stack basics through control flow, input/output, arrays, and debugging.
Tests cover the new programs, integer boundaries, Unicode input, invalid expressions, source locations, execution paths, and trace output. The full suite contains 101 passing tests.
Existing programs remain compatible. No language syntax changes are introduced.
Full Changelog: v1.9.0...v1.10.0
v1.9.0
Changes
- Add
우라라 야다/urara yada/ウララ ヤダto read one UTF-8 line into a Unicode code point array. - Remove the terminating LF or CRLF while preserving spaces, tabs, and NUL characters.
- Support empty lines and final lines without a newline.
- Report EOF without data, invalid UTF-8, and lines exceeding 1 MiB as runtime errors.
- Add string echo and length examples, tests, and documentation.
Read and print a line
우라라 야다
야다 이이이야하
Input: 가나다 followed by Enter
Output: 가나다
The input command creates [44032, 45208, 45796]. The output command prints those code points as characters without adding a newline.
printf '가나다\n' | yahalang run examples/string_echo.yaha --lang koGet the string length
우라라 야다
야다 뿌루루
이이이야하 뿌루루
Input: 가나🦀 followed by Enter
Output: 3
Length counts Unicode scalar values. Combining sequences may contain multiple elements even when displayed as one character.
Existing programs remain compatible. Empty lines produce empty arrays. EOF without data is an error; character input retains its existing -1 EOF behavior.
Full Changelog: v1.8.0...v1.9.0
v1.8.0
Changes
- Add
야다 이이이야하/yada iiiiyaha/ヤダ イイイヤハto print an integer array as Unicode characters. - Print elements in array order without adding a newline.
- Consume one array reference on success without modifying the array.
- Validate every character value before output begins.
- Add an input collection example, tests, and documentation.
Character array output
Read two characters, append them to an array, then print the array:
야다 하야하
우라라 이이이야하
야다 뿌루
우라라 이이이야하
야다 뿌루
야다 이이이야하
Input: 가나
Output: 가나
The array stores [44032, 45208]. The output command converts those code points back into characters.
To keep the array for later use, duplicate its reference before printing:
뿌루
야다 이이이야하
Collect and print until EOF
printf 'Hello, 안녕!\n' | yahalang run examples/print_character_array.yaha --lang koOutput:
Hello, 안녕!
The example collects all input until EOF before printing. Whitespace, input newlines, and NUL characters are preserved. Empty arrays print nothing.
Existing programs remain compatible. Invalid character values produce no output and leave the stack unchanged. Output device failures retain the array reference, but bytes already written cannot be rolled back.
Full Changelog: v1.7.0...v1.8.0
v1.7.0
Changes
- Add
야다 우라라/yada urara/ヤダ ウララto create an independent copy of an array. - Keep the original array on the stack and place the copy above it.
- Preserve existing
뿌루reference-sharing behavior. - Report stack underflow and wrong types without modifying the stack.
- Add an array copy example, tests, and documentation.
Independent array copy
Create an array containing 1, copy it, then append 2 to the copy:
야다 하야하
하야하 뿌루 야하
야다 뿌루
야다 우라라
하야하 뿌루뿌루 야하
야다 뿌루
In the REPL, :stack now shows:
[[1], [1, 2]]
The original remains [1]. Using 뿌루 instead of 야다 우라라 would share the same array and produce [[1, 2], [1, 2]].
Run the example
yahalang run examples/array_copy.yaha --lang koOutput: 21
The example prints the modified copy’s length (2), followed by the original’s length (1).
Existing programs remain compatible.
Full Changelog: v1.6.0...v1.7.0
v1.6.0
Changes
- Add
우라 이야/ura iya/ウラ イヤto break out of the nearest enclosing loop. - Support breaking from conditional blocks and nested loops without changing the stack or arrays.
- Reject loop breaks outside a loop during parsing.
- Add a zero-terminated input example, tests, and documentation.
Loop break example
하야하 뿌루뿌루뿌루 야하
이야 야다야다
우라 이야
우라 야다야다
이이이야하 뿌루루
Output: 3
우라 이야 exits the loop even though the condition remains nonzero. The value stays on the stack and is printed after the loop. Unlike 얏, it does not end the entire program.
Stop reading at zero
The included example prints integers until it reads 0:
printf '3\n2\n0\n' | yahalang run examples/break_on_zero.yaha --lang koOutput: 32
The example compares each input with 0 and breaks from inside a conditional block. Zero is not printed. EOF before zero is an integer input error.
Existing programs remain compatible.
Full Changelog: v1.5.0...v1.6.0
v1.5.0
Changes
- Add spoken phrases for all array operations in Korean, English, and Japanese.
- Support creating empty arrays, appending integers, and popping the last element.
- Add spoken equivalents for array length, element lookup, and element assignment.
- Preserve shared array references when appending or popping.
- Report append/pop operand errors and empty-array pops without changing the stack or array.
- Update array examples and add a program that reverses input until EOF.
Array commands
| Operation | Korean | English | Japanese |
|---|---|---|---|
| Create an empty array | 야다 하야하 |
yada hayaha |
ヤダ ハヤハ |
| Append an integer | 야다 뿌루 |
yada ppuru |
ヤダ プル |
| Pop the last element | 야다 우라 |
yada ura |
ヤダ ウラ |
| Get array length | 야다 뿌루루 |
yada ppururu |
ヤダ プルル |
| Get an element | 야다 이야 |
yada iya |
ヤダ イヤ |
| Set an element | 야다 핫 |
yada hat |
ヤダ ハッ |
Append and pop
Create an empty array, append 1 and 2, then pop and print them:
야다 하야하
하야하 뿌루 야하
야다 뿌루
하야하 뿌루뿌루 야하
야다 뿌루
야다 우라
이이이야하 뿌루루
야다 우라
이이이야하 뿌루루
Output: 21
Append and pop keep the array reference on the stack. After the first pop, [[1, 2]] becomes [[1], 2]. Printing consumes 2, leaving the array ready for another operation.
Length, lookup, and assignment consume their operands, including the array reference. Duplicate the reference first if you need to reuse it.
Reverse input
Read characters into an array until EOF, then pop and print them in reverse order:
printf '가나다' | yahalang run examples/reverse_input.yaha --lang ko
Output: 다나가
Reversal operates on Unicode scalar values. Input newlines are reversed too; combining sequences are not kept together.
Existing programs remain compatible. Array literals and the
#,@, and=commands remain supported.
Full Changelog: v1.4.0...v1.5.0
v1.4.0
Changes
- Add
우라라 이이이야하/urara iiiiyaha/ウララ イイイヤハto read a Unicode character and push its code point. - Preserve whitespace, line endings, and NUL characters without consuming following characters.
- Push -1 at EOF and report invalid or truncated UTF-8 as a runtime error.
- Add a character echo example and tests for Unicode input, EOF, and REPL integration.
Character input and output
Read a character with 우라라 이이이야하, then print it with the reversed phrase 이이이야하 우라라:
우라라 이이이야하
이이이야하 우라라
Input: 가 → Output: 가
Read a character as a number
Characters are stored on the stack as integer code points. Use integer output to inspect the value:
우라라 이이이야하
이이이야하 뿌루루
Input: 가 → Output: 44032
Input: A → Output: 65
EOF → Output: -1
Echo input until EOF
The included example reads and prints characters until EOF:
printf 'Hello, 안녕!\n' | yahalang run examples/character_echo.yaha --lang koOutput:
Hello, 안녕!
Existing programs remain compatible. EOF produces -1, which must be checked before character output. Character input shares the same stream as integer input and the REPL; unread characters and line endings remain available for subsequent reads.
Full Changelog: v1.3.0...v1.4.0
v1.3.0
Changes
- Preserve stack values and shared array references between REPL submissions.
- Add
:stackto inspect the stack and:resetto clear the state and pending source. - Support multiline input for unfinished blocks, numbers, arrays, and command phrases with a
...>continuation prompt. - Report syntax errors without clearing existing values, and preserve changes made before runtime errors.
- Add REPL integration tests and update documentation.
Persistent REPL example
Start the REPL with yahalang repl --lang en. Values remain on the stack between submissions:
yaha> hayaha ppuruppuru yaha
yaha> ppuru
yaha> yaha
yaha> :stack
[4]
yaha> iiiiyaha ppururu
4
yaha> :reset
yaha> :stack
[]
yaha> :q
Full Changelog: v1.2.0...v1.3.0