|Porting lex scanner on EBCDIC machine. c1veeru@WATSON.IBM.COM (Virendra K. Mehta) (1995-04-01)|
|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-03)|
|Re: Porting lex scanner on EBCDIC machine. email@example.com (1995-04-04)|
|Re: Porting lex scanner on EBCDIC machine. firstname.lastname@example.org (1995-04-05)|
|Re: Porting lex scanner on EBCDIC machine. email@example.com (1995-04-15)|
|Re: Porting lex scanner on EBCDIC machine. firstname.lastname@example.org (1995-04-18)|
|From:||email@example.com (Michael W. Duffy)|
|Organization:||NETCOM On-line Communication Services (408 261-4700 guest)|
|Date:||Mon, 3 Apr 1995 17:27:28 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.
I don't know about lex but flex scanners contain a table named yy_ec
that functions very much like a 370 TRT instruction. It uses each input
character as an index into this table and retreives a state number from
that location. You can translate this table (by hand) from an ASCII to an
EBCDIC basis by taking the state number in each location of the table
and moving it to the location that code value occupies in EBCDIC. The
new table can replace the old and the scanner can then be compiled
in the EBCDIC environment.
However, for this approach to work, you must tell flex to produce an 8
bit scanner (the default is 7). Scanners built with the 7 bit option have
a yy_ec table that is only 128 bytes. Some versions of flex were built
without the option to produce 8 bit scanners so you may have to try a few
versions or get the sources (any GNU archive) and make flex yourself.
Another approach is to get the source for flex and port that to the
mainframe but that may take you more time than it's worth. If the .l file
changes infrequently I would suggest the first approach.
I wrote a program that performs the transposition in a klugey but
effective way. I can send it to you if you wish. Contact me by email
since I infrequently cruise these mail lists.
Return to the
Search the comp.compilers archives again.