ANTLR问题临时记录3

1. ANTLR 3的if~else~歧义警告问题

ANTLR - Introduction 

(ANother Tool for Language Recognition) 

VB HC4  http://fmt.cs.utwente.nl/courses/vertalerbouw/

http://fmt.cs.utwente.nl/courses/vertalerbouw/sheets/vb-04-antlr-1-4up.pdf

(这个ppt对ANTLR的原理和技巧总结得很好,很值得一看)

另外,官方教程称,此警告其实可以无视掉(不需要消除),原文见

http://www.antlr.org/wiki/display/ANTLR3/Pie

 

To build this interpreter, run ANTLR on Pie.g and then compile all of the Java files in the directory:

$ java org.antlr.Tool Pie.g
warning(200): Pie.g:51:39: Decision can match input such as "'else'"
using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
$ javac *.java
$
You can ignore the warning message from ANTLR; it's the standard if-then-else ambiguity. (See Subsection Nondeterministic Decisions of Section 11.5 in The Definitive ANTLR Reference for more details.)
 

 

你可能感兴趣的:(antlr)