[antlr-interest] ANTLR v3 - java tree grammar

robermann robermann at gmail.com
Tue Jun 12 02:22:47 PDT 2007


Hi all
Is it available a java tree grammar for ANTLR v3? Processing the grammar on:
http://www.antlr.org/grammar/1109874324096/java1.5.zip I got the exception:

ANTLR Parser Generator  Version 3.0 (May 17, 2007)  1989-2007
error(100): java.g:158:1: syntax error: antlr: java.g:158:1: unexpected
token: c
lass
error(100): java.g:158:22: syntax error: antlr: java.g:158:22: expecting
SEMI, f
ound 'extends'
error(10):  internal error: java.g : java.g:1508:8: expecting '"', found 'r'
org.antlr.tool.ANTLRLexer.nextToken(ANTLRLexer.java:321)
antlr.TokenStreamRewriteEngine.nextToken(TokenStreamRewriteEngine.java:161)
antlr.TokenBuffer.fill(TokenBuffer.java:69)
antlr.TokenBuffer.LA(TokenBuffer.java:80)
antlr.LLkParser.LA(LLkParser.java:52)
antlr.Parser.consumeUntil(Parser.java:149)
antlr.Parser.recover(Parser.java:312)
org.antlr.tool.ANTLRParser.grammar(ANTLRParser.java:406)
org.antlr.tool.Grammar.setGrammarContent(Grammar.java:521)
org.antlr.tool.Grammar.<init>(Grammar.java:456)
org.antlr.Tool.getGrammar(Tool.java:331)
org.antlr.Tool.process(Tool.java:267)
org.antlr.Tool.main(Tool.java:70)

(I'm new to ANTLR and didn't realize v3 was *so* different from the previous
versions :) )

By the way, in the future I'd like to use ANTLR in my project "CodeSounding"
(http://codesounding.org/indexeng.html) to hook sonification actions. Now
I'm using a modified javacc parser, ie a modified java source file generated
from the grammar. The modifications were necessary to insert contextual
checks (for example if I add an instruction after a throw statement the java
compiler laments an unreachable code). I think a declarative way like
rewriting token actions embedded in the tree grammar is a better way.

Best regards
Roberto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070612/60c1984e/attachment-0001.html 


More information about the antlr-interest mailing list