|Advice sought: Parsing a line of COBOL in C. email@example.com (1996-01-12)|
|Re: Advice sought: Parsing a line of COBOL in C. firstname.lastname@example.org (John Lindsay) (1996-01-16)|
|From:||John Lindsay <email@example.com>|
|Date:||16 Jan 1996 13:49:59 -0500|
|Organization:||Royal Military College|
firstname.lastname@example.org (Darrin Smith) wrote:
>I'm trying to convert a COMPUTE statement in COBOL from:
> COMPUTE variable1 = variable2 * -1
> 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
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
Return to the
Search the comp.compilers archives again.