implemented orelang with dart language.
c.f. https://qiita.com/Uchijo/items/4fd9849ac223b80d7615
dart run 'some program here'
$ dart run bin/orelang_dart.dart '["+", 40, 2]'
result: 42
- integer
- bool
- novalue
- something like null or nil in other language.
>
,<
,==
,+
,*
,and
,or
[op, expression1, expression2]
- operators.
while
["while", condition, expression]
- evaluates expression while condition is true.
- returns result of evaluation on last expression.
- novalue is not counted as "last expression".
- if there's no valid expression evaluation in while loop, it will return novalue.
set
["set", "identifier", expression]
- variable named identifier will be initialized with value expression. overwrite is allowed.
- returns evaluated value of expression
get
["get", "identifier"]
- retrieves value of variable with the identifier.
step
["step", expression, ...]
- evaluates all given expressions.
- returns result of evaluation on last expression.
- novalue is not counted as "last expression".
- if there's no valid expression evaluation in steps, it will return novalue.
if
["if", cond, on_true, on_false]
skip
["skip"]
- doees nothing.
- returns novalue.