-
Notifications
You must be signed in to change notification settings - Fork 5
Language Specification
-
"‥"
: Literal value -
r"‥"
: Regular expression -
<‥>
: Composition -
[‥]
: Optional -
{‥}
: Grouping for|
or repeat -
|
: Or -
...
: Repeat zero or more times
"&" <identifier>
"(" <expression> <operator> <expression> ")"
"!" <expression>
<multi-line-comment> | <single-line-comment>
{ <define-declaration> | <global-variable-declaration> | <object-declaration> } ...
r"[0-9]"+
"define" <identifier> <expression>
<address-expression> | <arithmetic-expression> | <bang-expression> | <handle-expression> | <identifier> | <numeric-literal> | <string-literal>
"DATA8" | "DATA16" | "DATA32" | "DATAF" | "HANDLE"
"IN_8" | "OUT_8" | "IO_8" | "IN_16" | "OUT_16" | "IO_16" | "IN_32" | "OUT_32" | "IO_32" | "IN_F" | "OUT_F" | "IO_F" | "IN_H" | "OUT_H" | "IO_H"
<decimal-literal> [ "." <decimal-literal> ] "F"
<identifier> "(" [ <expression> [ "," <expression> ] ... ] ")"
Note: identifier must be a valid op code
<variable-declaration>
"@" <identifier>
r"0x[0-9A-Fa-f]+"
r"[A-Za-z_][A-Za-z_0-9]*"
<decimal-literal> | <hexadecimal-literal>
<identifier> ":"
<variable-declaration>
r"/*.**/"
<integer-literal> | <float-literal>
{ "block" | "subcall" | "vmthread" } <identifier> "{" { <local-variable-declaration> | <parameter-declaration> | <function-call> | <label> } ... "}"
Note: parameter-declaration is only allowed for "subcall"
"+" | "-" | "*" | "/"
<fixed-size-parameter-type> <identifier>
<variable-size-parameter-type> <identifier> <expression>
Note: expression must resolve to an integer value
r"//.*$"
"'" { r"[ -&(-][-~]" | "\n" | "\q" | "\r" | "\t" } ... "'"
<fixed-size-data-type> <identifier>
<variable-size-data-type> <identifier> <expression>
"ARRAY8" | "ARRAY16" | "ARRAY32" | "ARRAYF" | "DATAS"
Note: Official compiler also includes "global" for global variable and "local" for local variables but they are not used in practice, so omitting it for now.
"IN_S" | "OUT_S" | "IO_S"
LEGO® is a trademark of the LEGO Group of companies which does not sponsor, authorize or endorse this site