GitHub - remikeat/stackl

1 min read Original article ↗

Skip to content

Navigation Menu

Stackl

This is a stack machine based language

It is the ocaml version of https://github.com/msakuta/rustack

You can try it online at https://stackl.remikeat.com/

Results

koch

The image above was produced by below script

/koch {
    /level exch def
    /scale exch def

    { level 5 < }
    {
        save
        scale 3. div level 1 + koch
        scale 100 * 0 translate
        pi -3. div rotate
        scale 3. div level 1 + koch
        scale 100 * 0 translate
        pi 2. * 3. div rotate
        scale 3. div level 1 + koch
        scale 100 * 0 translate
        pi -3. div rotate
        scale 3. div level 1 + koch
        restore
    }
    {
        begin_path
        0 0 move_to
        scale 300 * 0 line_to
        stroke
    }
    if
} def
10 300 translate
2. 1 koch

How to build

or

How to run

cat scripts/koch.sl | ./_build/default/stackl.exe

How to quit

Press q