`

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.)
 

 

分享到:
评论

相关推荐

    ASP.NET多文件上传

    当用户提交包含文件的表单时,这些对象会存储上传的文件信息,包括文件名、大小和临时存储路径。 接下来,我们需要创建一个ASP.NET控件,通常是FileUpload控件,用户可以通过这个控件选择要上传的文件。在HTML代码...

    语法分析程序(java翻译C) 编译原理课程设计

    3. **语义分析(Semantic Analysis)**:此阶段检查代码的逻辑正确性,例如类型匹配、作用域规则和常量表达式的值。对于`int36`的支持,可能涉及创建一个新的数据类型或者对数值处理的扩展。 4. **中间代码生成...

    hibernate概述

    Hibernate 运行需要一些关键的库,例如 `antlr` 处理HQL,`javassist` 处理字节码,`jta.jar` 支持分布式事务,`commons-collections` 提供工具方法,`dom4j` 处理XML,`slf4j` 提供日志服务等。 10. **...

    Ant Tasks1.6.0.pdf

    2. **ANTLR**:支持 ANTLR 工具的任务。 3. **Attrib**:修改文件属性。 4. **Cab**:创建或解压 CAB 文件。 5. **Chgrp**:更改文件或目录的所有者组。 6. **Chown**:更改文件或目录的所有者。 7. **Ant ClearCase...

Global site tag (gtag.js) - Google Analytics