diff options
| author | kitty <nepeta@canaglie.net> | 2026-02-26 19:57:03 +1100 |
|---|---|---|
| committer | kitty <nepeta@canaglie.net> | 2026-02-26 19:57:03 +1100 |
| commit | bd3d65292be72d47b5b0be3bdec23d4e46b6fd6e (patch) | |
| tree | 47dff703150ce2fbbd1c5fbce5325fbb31aa6282 | |
| parent | dd03b8ca6cdd54237b22c8e9c8e67e3323c0998f (diff) | |
CASE (from jonesforth)
| -rw-r--r-- | jefs.fs | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -1,7 +1,6 @@ \ i think something is going on with the stack. i dunno \ things TODO: \ EVALUATE -\ CASE \ DO LOOP \ <builds does> \ argc/argv @@ -53,6 +52,12 @@ hex : ret, c3 c, ; decimal : ?dup dup 0<> if dup then ; +\ jonesforth impl +: case 0 ; immediate +: of ' over compile, ' = compile, [compile] if ' drop compile, ; immediate +: endof [compile] else ; immediate +: endcase ' drop compile, begin ?dup while [compile] then repeat ; immediate + \ TODO interpret mode strings? \ i think s" causes stack underflow : s" 1 >in +! [ char " ] literal cparse branch >mark >r 2dup cmove, r> >resolve swap [compile] lit [compile] lit ; immediate @@ -191,5 +196,5 @@ variable hld \ : teststr3 s" 1 2 3 .s" ; \ \ teststr3 evaluate -.free +t .free bye |
