|Porting lex scanner on EBCDIC machine. c1veeru@WATSON.IBM.COM (Virendra K. Mehta) (1995-04-01)|
|Re: Porting lex scanner on EBCDIC machine. email@example.com (1995-04-03)|
|Re: Porting lex scanner on EBCDIC machine. firstname.lastname@example.org (1995-04-03)|
|Re: Porting lex scanner on EBCDIC machine. email@example.com (1995-04-03)|
|Re: Porting lex scanner on EBCDIC machine. firstname.lastname@example.org (1995-04-04)|
|Re: Porting lex scanner on EBCDIC machine. email@example.com (1995-04-05)|
|Re: Porting lex scanner on EBCDIC machine. firstname.lastname@example.org (1995-04-15)|
|Re: Porting lex scanner on EBCDIC machine. email@example.com (1995-04-18)|
|From:||firstname.lastname@example.org (Anavai G Ramesh)|
|Organization:||University At Albany, New York, USA|
|Date:||Mon, 3 Apr 1995 19:46:40 GMT|
Virendra K. Mehta <c1veeru@WATSON.IBM.COM> wrote:
>I have a scanner developed using lex on a Unix machine (ASCII). It is a
>front end for a processor that works on COBOL files. The files taken off a
>mainframe are processed on the Unix machine and the modified files are
>transferred back. To do away with this transfer business, I'm trying to
>port the scanner onto the mainframe. However the mainframe uses EBCDIC
>while lex generated tables, state machines etc. expect an ASCII input.
Simple. There are two ways to do this. If you have the original
lex specs, you can do it using the the %T definition.
Add the following code to the file containing the lex specs.
<EBCDIC value> <symbol>
If you don't have the lex specs, then you need a hack in the
generated file. The lex generated file (lex.yy.c) usually has a
routine called input. Modify this routine so that it returns the
ASCII value of the character rather than that EBCDIC value read from
the input file. Lex also uses a unput routine which puts a character
into a buffer so that the input routine can read it again. unput
must be modified to put the EBCDIC value in the buffer.
Lex introduces character constants like 'a' in the generated file (I
cannot understand why). Scan the generated files and replace all
constants by their ASCII values.
This works. I had used this technique to build a COBOL
parser for an IBM machine a few years ago.
Return to the
Search the comp.compilers archives again.