You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
643 B
24 lines
643 B
operator = @{ "operator" } // TODO
|
|
operand = @{ "operand" } // TODO
|
|
|
|
instruction = { operator ~ (spacing+ ~ operand)? }
|
|
|
|
loopBlockStart = { "[" ~ newline }
|
|
loopBlockEnd = { "]" }
|
|
loopBlock = { loopBlockStart
|
|
~ statements
|
|
~ newline
|
|
~ loopBlockEnd
|
|
}
|
|
|
|
statement = _{ spacing*
|
|
~ (instruction | loopBlock)
|
|
}
|
|
|
|
statements = _{ statement* }
|
|
|
|
newline = _{ "\n" | "\r\n" }
|
|
spacing = _{ " " | "\t" }
|
|
COMMENT = _{ ";;" ~ (!newline ~ ANY)* ~ newline}
|
|
|
|
file = {SOI ~ (statement ~ newline+)* ~ EOI}
|
|
|