[antlr-interest] The combined grammar definition

Sam Ellis Sam.Ellis at arm.com
Tue Dec 11 03:40:37 PST 2007


antlr-interest-bounces at antlr.org wrote:
> In the antlr V2 one could define all three grammars (lexer, parser &
> tree) in the single file, each with it's own 'option' and 'header'
> information. 
> 
> How to define a combine grammar in ANTLR3 heaving possibility to
> separately define @header, @members,... section for each of the
> grammars, all in one file? 

Prefix the section name with the grammar type, for example:

@parser::header {
}

@lexer::header{
}

The same applies for members etc.


-- 
Sam Ellis, Engineering Manager,
Product Engineering Group,                 Tel: +44 (0) 1223 400516
System Design Division,                    Fax: +44 (0) 1223 400887
ARM Ltd., 110 Fulbourn Road,               skype:armsamellis
Cambridge, CB1 9NJ                         mailto:sam.ellis at arm.com

-- 
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium.  Thank you.




More information about the antlr-interest mailing list