To avoid introducing a parser for arithmetic/comparison/logic expressions I did what any sensible person would do, create a stack language hybrid. Not

marianoguerra / hiapl Public

submited by
Style Pass
2022-01-14 12:30:03

To avoid introducing a parser for arithmetic/comparison/logic expressions I did what any sensible person would do, create a stack language hybrid.

Note: can be used inside cond where if true stops evaluating conditions (like if/else if) or outside where it works like a single if without else if/else branches.

Binds each item in an iterator to a variable and embeds the body of the for tag as many times as items in the iterator with the item bound to the provided variable.

Push value in variable $i to the stack: <do push $i></do> Push number 3 to the stack: <do push 3></do> Call reminder (takes 2 values from the stack and pushes the result): <do rem></do>

<nb>i = <v $i></v> i % 3 == 0? <v $isMod3></v></nb> will print something like i = 1 i % 3 == 0? false to the console

Leave a Comment
Related Posts