如何消除EBNF Instaparse语法中的歧义

时间:2018-06-02 19:12:40

标签: clojure ebnf instaparse

如何防止结构规则中的“,”文字在Instaparse的以下EBNF语法中被解析为运算符?

语法:

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

1 个答案:

答案 0 :(得分:0)

使用逗号作为分隔符和像你一样的运算符使得逗号上下文敏感,而Ebnf本身无法处理。