[antlr-interest] IBM MVS JCL recognition

Jim O'Connor Jim.OConnor at microfocus.com
Thu Mar 13 14:05:48 PST 2003


I've run across a difficulty.  Assume the token filter piece is working.  I
like the idea.

I have a bunch of examples that don't fit with the screw-y-ness of JCL.

Example I

OBJECT1 value: "Mon"
OBJECT2 value: "ty"

JCL TEXT:

//S02 EXEC PGM=THEFULL&OBJECT1&OBJECT2


Result will be

//SO2 EXEC PGM=THEFULLMonty

To hold the token queue model, the Parser rule for an identifier would be
(IDENT)* to concatenate all the parts of Monty together.  Or would another
filter be a wise choice?


Example II

String strangeness

//S02 EXEC PGM=Monty,VALUENAME='&INARDS'

INARDS could be = "DISP=SHR";


The result is 
//S02 EXEC PGM=Monty,VALUENAME='DISP=SHR'

The tokens that would be in the token queue would be different than if the
example was


//S02 EXEC PGM=Monty,&INARDS

resulting in 

//S02 EXEC PGM=Monty,DISP=SHR




Matching &INARDS in the token filter I would want to shove out STRING in the
first example.  The second example I want to shove out "IDENT" EQU "IDENT"
on three successive trips to the token filter.

Once again, any help is greatly appreciated.

Jim


-----Original Message-----
From: mzukowski at yci.com [mailto:mzukowski at yci.com]
Sent: Thursday, March 13, 2003 2:03 PM
To: antlr-interest at yahoogroups.com
Subject: RE: [antlr-interest] IBM MVS JCL recognition


Why don't you just insert all the tokens into the stream?  Basically you
could keep a token queue in your filter and just be sure to empty the queue
before you pull another token from the lexer.

Monty

-----Original Message-----
From: Jim O'Connor [mailto:Jim.OConnor at microfocus.com]
Sent: Thursday, March 13, 2003 10:59 AM
To: antlr-interest at yahoogroups.com
Subject: [antlr-interest] IBM MVS JCL recognition


Hi all,
  JCL has a number of fun recognition problems for which ANTLR might have
solutions.  There hasn't been a publicly available JCL grammar, as far as I
know.  I'll start with a direct ANTLR related question, just to get the ball
rolling.

  JCL has "symbolic replacement".  For example, "OBJECT" below would be
assigned a value, say "FILE.NAME".

//SYSLIN DD DSN=&OBJECT,UNIT=SYSDA,SPACE=(CYL,1)

  which results in 

//SYSLIN DD DSN=FILE.NAME,UNIT=SYSDA,SPACE=(CYL,1)

  For this example I see a TokenStreamFilter working nicely.  I gather the
definitions (Hashtable), get a "symbolic" token, look up the definition and
replace the text.

  Another example gets more complicated. Setting OBJECT =
"FILE.NEW,MYOPTION(1,4)", would translate to


//SYSLIN DD DSN=FILE.NEW,MYOPTION(1,4),UNIT=SYSDA,SPACE=(CYL,1)

 I don't have a token for token match.  I would be more comfortable
resorting back to a character stream and re-lexing.  I'd be glad to make the
example clearer if it isn't well described.

  Looking forward to hearing opinions, comments and being directed down
productive paths..... if there is such parsing JCL.

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