diff --git a/src/grammars/mblf.pest b/src/grammars/mblf.pest index cf2ca56..54f5e6c 100644 --- a/src/grammars/mblf.pest +++ b/src/grammars/mblf.pest @@ -1,15 +1,17 @@ -operator = @{ "operator" } // TODO -operand = @{ "operand" } // TODO +operator = @{ "operator" } // TODO +operand = @{ "operand" } // TODO -instruction = { operator ~ (" "+ ~ operand)*} +instruction = { operator ~ (" "+ ~ operand)* } -loopBlockStart = { "[" } -loopBlockEnd = { "]" } -loopBlock = { loopBlockStart - ~ instruction* - ~ loopBlockEnd -} +loopBlockStart = { "[" } +loopBlockEnd = { "]" } +loopBlock = { loopBlockStart + ~ statements + ~ loopBlockEnd + } + +statement = _{ instruction | loopBlock } +statements = _{ statement* } -statement = _{ instruction | loopBlock } file = {SOI ~ (statement ~ ("\n" | "\r\n")+)* ~ EOI}