JavaCC - 如何在没有前瞻的情况下删除此语句中的所有选择冲突?

问题描述 投票:1回答:1

我正在为我的语法开发一个解析器。我的目标是让它毫无前瞻,而这正是我真正努力的目标。

这是一个缩小的例子,我相信这足以证明我遇到的问题。

void main() : {}
{
    (A())* (B())*
}

void A() : {}
{
    C() <ID>
}

void B() : {}
{
    <ID> Z()
}

void C() : {}
{
    <bah>
    | <bha>
    | <ID>
}

这是输出警告(我想删除它)

Warning: Choice conflict in (...)* construct at line 200, column 23.
         Expansion nested within construct and expansion following construct
         have common prefixes, one of which is: <ID>
         Consider using a lookahead of 2 or more for nested expansion.
java javacc lookahead ambiguity
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.