The Wheel syntax looks a little bit like Pascal or Basic.
Wheel only allows a single command or expression per line, the only exception is an assignment of a record or array.
proc main() number n = 1 end
An example of a multi line variable assignment:
proc main() number p[2][3] = [ [90, 100, 110], [220, 230, 240] ] end
A semicolon (";") marks the beginning of a comment.
proc main() ; This is a comment and will not be executed... end
Comments should be placed after the command or expression. Wheel only supports single line comments, everything after the simicolon is seen as a comment text.
Wheel uses a block structure which begins with the declaration of the type or command followed by an expression and closed with an end statement.
struct MyStruct number end proc main() end
Some statements can be nested:
struct MyStruct number end proc main() number a = 1 number b = 0 if a == 1 if (b == 1) ; Parentheses are optional here... printS("A and B are 1") end else printS("A is not 1") end end
Number values can be declared as decimal, binary or hexadecimal.
proc main() number n = 10 number b = 0b01001 number h = 0x2AE end
Meta commands are parsed by the preprocessor.
A meta command starts with the "#" character and must be the first command on the line.
With the include command you can import an existing file like a library.
"lib/modules/screen.whl" proc main() drawNumber(10, 5, 90) end