Aruscher
Aruscher

Reputation: 145

How to remove ambiguity in EBNF Instaparse grammar

How can i prevent that the "," literal in the structure rule is parsed as a operator in the following EBNF grammar for Instaparse?

Grammar:

structure = atom <"("> term ("," term)* <")"> 
term = atom | number | structure | variable | "(" term ")" | term operator term
operator = "," | ";" | "\\=" | "=="

Upvotes: 1

Views: 154

Answers (1)

Uran
Uran

Reputation: 141

Using the comma as a separator and as an operator like you do makes comma context sensitive which Ebnf on its own can't deal with.

Upvotes: 0

Related Questions