Re: Advice sought: Parsing a line of COBOL in C.

John Lindsay <lindsay-j@rmc.ca>
16 Jan 1996 13:49:59 -0500

          From comp.compilers

Related articles
Advice sought: Parsing a line of COBOL in C. fignet05.darrins@eds.com (1996-01-12)
Re: Advice sought: Parsing a line of COBOL in C. lindsay-j@rmc.ca (John Lindsay) (1996-01-16)
| List of all articles for this month |
From: John Lindsay <lindsay-j@rmc.ca>
Newsgroups: comp.compilers
Date: 16 Jan 1996 13:49:59 -0500
Organization: Royal Military College
References: 96-01-023
Keywords: Cobol, parse

fignet05.darrins@eds.com (Darrin Smith) wrote:
...
>I'm trying to convert a COMPUTE statement in COBOL from:
>
> COMPUTE variable1 = variable2 * -1
>to
> COMPUTE variable1 = 0 - variable2
>
>It would be no problem if the compute always followed this format, but
>of course it does not. ....
...


>[I'd convert it to a string of tokens, squashing out the confusing
>white space and all, then do some simple pattern matching on the token
>string. -John]


This is scarcely a compiler job, much more like a job for a macro
processor or a simple program in a string handling language such as
SNOBOL4 or Icon. If you can get a copy of the PL/I-based macro
language LP2257 and replace the PL/I tokenizer, with a COBOL tokenizer,
it's a breeze, and it would only be a bit more work with the macro
language ML/I's generic tokenizer. A small Icon program is probably
the simplest, quickest solution, and Icon is free. See comp.lang.icon
for an FAQ.


--
All the best !


John H. Lindsay, Phone: (613) 541-6000 - 1 - 6419
Department of Mathematics and Computer Science,
Royal Military College of Canada, Internet: Lindsay_J@RMC.CA
Kingston, Ontario, Canada, K7K 5L0. Fax: (613) 542-8129
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.