我的语法似乎有效,但会生成大量警告。 这些警告有多严重,有人可以就如何修复它们提供一些指导吗?
Warning 200
Decision can match input such as "LCURLY LPAREN" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
Warning 200:
Decision can match input such as "LCURLY PLUS" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
Semantic predicates were present but were hidden by actions.
Warning 203
Input such as "Date" is insufficiently covered with predicates at locations: alt 1: line 346: at Date, al
t 2: line 346: at Date
对于警告(200),禁用替代方案会有什么影响?我认为最主要的是,潜在的 AST 可能具有不同的形状,具体取决于禁用的替代方案。
我不确定 warning(203) 的含义。
最佳答案
您的语法可能有歧义,因为不止替代路径可以解析相同的输入字符串。所以解析器不知道哪个是“正确”的方式。您应该更正语法或语义谓词以防止歧义。
关于java - 这些 ANTLR 警告是什么意思,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13768201/