[antlr-interest] Having the "include" file as part the AST

Jim O'Connor Jim.OConnor at microfocus.com
Mon May 12 12:48:08 PDT 2003


Thanks.  The link and the "buffered tokens" comment hit the spot.  Haven't
finished yet, but it looks good.


-----Original Message-----
From: mzukowski at yci.com [mailto:mzukowski at yci.com]
Sent: Monday, May 12, 2003 12:02 PM
To: antlr-interest at yahoogroups.com
Subject: RE: [antlr-interest] Having the "include" file as part the AST


Also consider using an approach like the one I did here:

http://www.codetransform.com/filterexample.html

Alternatively you may need to buffer tokens in your lexer.  It's not hard to
do but you have to subclass the generated lexer to override nextToken() to
check your buffer first.  Actually it's very similar to the filterexample
code.

Monty

-----Original Message-----
From: Jim O'Connor [mailto:Jim.OConnor at microfocus.com]
Sent: Monday, May 12, 2003 8:33 AM
To: antlr-interest at yahoogroups.com
Subject: [antlr-interest] Having the "include" file as part the AST


Hi All,
	I am working with the Job Control Language (JCL).  It has statements
that "describe" INCLUDE-type files.

//**** Main File ****/
//LABEL1   EXEC PROC=MYPROC,SYMB1=VALUE1


/*********  Proc file: MYPROC.PRC *********/
//D1      DD       DSN=DATAFILE,DISP=&SYMB1
//D2      DD      DUMMY



What would result for processing is

//LABEL1   EXEC PROC=MYPROC,SYMB1=VALUE1
//D1      DD       DSN=DATAFILE,DISP=VALUE1
//D2      DD      DUMMY



	I am struggling with the INCLUDE file mechanism.  It hides the
INCLUDE file statement from the main parser.  An INCLUDE statement is not
part of the C language.  It is part of pre-processing.

	With my JCL parser, I am trying to create an AST that contains the
EXEC PROC statement.  Is there a mechanism that passes the "//" "LABEL1"
"EXEC" "PROC" "=" "MYPROC" tokens to the parser while starting the new lexer
at the correct time?  Is this description clear?
Jim


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list