[antlr-interest] Antlr v3.0ea8 : @header not taken into accountin
automatically generated lexer java code...
Jim Idle
jimi at temporal-wave.com
Wed May 3 01:22:43 PDT 2006
Just to clarify Ter's post here, @parser::header will work as well as @lexer::grammar, but there are 3 situations:
lexer grammar
parser grammar
combined lexer/parser grammar
Hence in a combined grammar you need to be explicit about where you want this header stuff to go. In a lexer or parser grammar you do not need to be. If you do not explicitly say so in a combined grammar, then the header stuff will go to the parser. I suppose there is an argument that if not explicit in a combined grammar then the information should go in both, but I suspect that once we have some docs this will make a lot more sense. The grammar syntax in ANTLR3 is a lot more orthogonal than it has ever been before and the whole process is very much more 'obvious' once you get going.
Jim
________________________________
From: antlr-interest-bounces at antlr.org on behalf of Terence Parr
Sent: Tue 5/2/2006 10:45 PM
To: ANTLR Interest
Subject: Re: [antlr-interest] Antlr v3.0ea8 : @header not taken into accountin automatically generated lexer java code...
On May 2, 2006, at 1:09 PM, Prashant Deva wrote:
> No, what i meant was this-
> According to the parent post, it seems if we want to declare a
> header for a parser, we just use-
> @header{}
>
> But to declare a header for lexer, we gotta use-
> @lexer::header{}
That is *only* if you are combining lexer and parser :)
> That is where it doesnt feel uniform.
@header{} is used if it's in the lexer by itself I believe.
> Dont you think it would be better if we used -
> @parser::header{}
> &
> @lexer::header{}
> for both the lexer & the parser.
I believe parser::header works; just implied.
> That way it would seem more uniform :)
Yep
Ter
More information about the antlr-interest
mailing list