On 02/08/15 18:37, MakersF wrote:

Of course it's recursive! Do you want the grammar to be able to only
define a finite number of programs?

I don't know how this work, that's why I'm asking. But I read something about left recursion needs to be removed to be able to parse a grammar, at least for some parsers.

But in this case you could write the original grammar rule as
mul |
cat |
(mul|cat)((+|-) (mul|cat))* (+|-) (mul|cat)

but you lose the precedence of the operation as it is a flat list and
not a tree

I don't think that's important for syntax highlighting.

--
/Jacob Carlborg

Reply via email to