Cheatsheet

Builtin Tasks and Operations

CategoryDescription
Binary operations+, -, *, /, ^
Unary operations+(number/string), -(numbers only), !(booleans)
Comparison operations>, >=, <, <=, ==, !=
Logic operationsand, or (short-circuit)
shellRun shell command
shellpipeRun shell pipeline (syntax sugar for shell)

Builtin Types

TypeDescription
Numberinternal representation will be a f64 (for both integers and floats)
Booleaneither true or false
StringAnything inside double quotes
ArraySame type items in [], separated by , (e.g., ["monday", "sunday"])
MappingNot directly defined or passed to functions, but can be returned. Access attributes using . by key (e.g., object.key).

Grammar Rules

The detail grammar rules, only come here when something is really hard to figure out and you want to figure it out by yourself. Otherwise, join and ask me in Oxiida Zulip.

Program structure

Non-terminalProduction
ProgramStatement*

Statements

Non-terminalProduction
StatementSimpleStmt ";" | Block | IfStmt | WhileStmt | ForStmt
SimpleStmtExpression | "print" Expression | "require" IdentifierList
Block"seq" "{" Statement* "}"
"para" "{" Statement* "}"
"{" Statement* "}"
IfStmt"if" "(" Expression ")" Statement
"if" "(" Expression ")" Statement "else" Statement
WhileStmt"while" "(" Expression ")" Statement
ForStmt"for" Expression "in" Array Statement
IdentifierListidentifier ( "," identifier )*

Expressions — precedence (low → high)

LevelNon-terminalProduction
8AssignmentShell "=" Expression | Logic
7LogicEquality { ( "and" \| "or" ) Equality }
6EqualityCompare { ( "==" \| "!=" ) Compare }
5CompareTerm { ( ">" \| ">=" \| "<" \| "<=" ) Term }
4TermFactor { ( "+" \| "-" ) Factor }
3FactorPower { ( "*" \| "/" ) Power }
2PowerUnary { "^" Unary }
1Unary( "+" \| "-" \| "!" ) Unary | Attribute

Primary & postfix

Non-terminalProduction
AttributeCallPostfix { "." identifier }
CallPostfixPrimary { "(" [ Expression { "," Expression } ] ")" }
Primary"true" | "false" | "nil"
number | identifier | string
"(" Expression ")"
Array | Shell | PipeShell

Composite literals & shell constructs

Non-terminalProduction
Array"[" [ Shell { "," Shell } ] "]"
PipeShell"shellpipe" "{" PipeShellExpr "}"
PipeShellExpr`PipeShellExpr "
ShellUnitstring string*
Shell"shell" "{" Term [, "[" Term { "," Term } "]"] [, Shell] "}" | Logic

Tokens / Lexical categories

CategoryLexemes (examples)
Keywordsif, else, while, for, seq, para, print, require, and, or, in, true, false, nil, shell, shellpipe
Operators= == != < <= > >= + - * / ^ ! .
Delimiters( ) { } [ ]
Literalsnumber (f64), string
Identifiersidentifier

Operator-precedence recap

PrecedenceOperators
1 (highest)+ - ! (unary)
2^
3* /
4+ - (binary)
5< <= > >=
6== !=
7and or
8 (lowest)=