[antlr-interest] tree parser syntax

Sam Barnett-Cormack s.barnett-cormack at lancaster.ac.uk
Thu Aug 20 05:40:44 PDT 2009


Safiye Celik wrote:
> Hi,
> I created two grammars, one is a lexer-parser grammar including tokens 
> and the parser rules, and the other is the tree grammar which walks on 
> the tree the lexer-parser grammar creates. But the problem is that, the 
> two grammar files create two .tokens files (each creates one) and the 
> token reference numbers are different in those files for the same token. 
> And in the .tokens file, the corresponding strings to the tokens are 
> represented because there are lexical rules in my lexer-parser grammar, 
> whereas in the .tokens file of the tree grammar, there are only the 
> string names and their token numbers. So, the two grammars do not know 
> they are related. How should I make them know this?Should I import 
> lexer-parser grammar in the tree grammar or sth like that?

Try the grammar option tokenVocab, explained in the context of 
treegrammars at http://www.antlr.org/wiki/display/ANTLR3/4.+Tree+Parsing

-- 
Sam Barnett-Cormack


More information about the antlr-interest mailing list