The main language of this project is still Bau.
This here is an experimental language.
- Minimalistic syntax. Tiny footprint (~450 lines of code).
- Operator overloading is supported.
- Ability to minify the code. Each keyword has a single-character shortcut:
? if, : else, * repeat,
@ while, + fun, ! return,
> print.
This is also useful for code golfing,
and writing programs on the command line, or on a phone.
- Assignment is
:, and = is comparison.
- Global variables and constants start with a capital letter.
- Text literals start and end with
'.
As in SQL, the only escape character is '' for '.
Use free-standing text literals as comments.
- Commas and semicolons are optional.
& and | are logical and bitwise "and" and "or".
- The only data type is: arrays of floating point values.
- Array indexing uses
.: a.0, a.1, a.2
- Zero error philosophy: out-of-bounds array access returns 0,
except for entry -1 which returns the length.
- Text has at least two elements (zero values are ignored).
<program> := <definition> | <expr> "," ...
<definition> := "fun" <id> <list> <list>
<list> := "(" <expr> [ "," ... ] ")"
<expr> := <primary> | <expr> <op> <expr>
<primary> := <literal> | <id> | <call> | <if> | <loop> | <return> | <list> | "-" <primary>
<if> := "if" <expr> <list> [ "else" <list> ]
<loop> := ( "while" | "repeat" ) <expr> <list>
<return> := "return" <expr>
<call> := <id> <list>
<literal> := digits [ "." digits ] | "'" characters "'"
<op> := ":" | "." | "*" | "/" | "+" | "-" | "=" | "<" | "&" | "|"
<id> := letter { letter | digit | "_" }