Re: Porting lex scanner on EBCDIC machine.

vern@daffy.ee.lbl.gov (Vern Paxson)
Wed, 5 Apr 1995 21:50:19 GMT

          From comp.compilers

Related articles
Porting lex scanner on EBCDIC machine. c1veeru@WATSON.IBM.COM (Virendra K. Mehta) (1995-04-01)
Re: Porting lex scanner on EBCDIC machine. gvcormac@plg.uwaterloo.ca (1995-04-03)
Re: Porting lex scanner on EBCDIC machine. mduffy@netcom.com (1995-04-03)
Re: Porting lex scanner on EBCDIC machine. rameshag@herbrand.cs.albany.edu (1995-04-03)
Re: Porting lex scanner on EBCDIC machine. kkaempf@didymus.rmi.de (1995-04-04)
Re: Porting lex scanner on EBCDIC machine. vern@daffy.ee.lbl.gov (1995-04-05)
Re: Porting lex scanner on EBCDIC machine. sasghm@unx.sas.com (1995-04-15)
Re: Porting lex scanner on EBCDIC machine. sasghm@unx.sas.com (1995-04-18)
| List of all articles for this month |

Newsgroups: comp.compilers
From: vern@daffy.ee.lbl.gov (Vern Paxson)
Keywords: lex
Organization: Lawrence Berkeley Laboratory, Berkeley CA
References: 95-04-035 95-04-054
Date: Wed, 5 Apr 1995 21:50:19 GMT

Michael W. Duffy <mduffy@netcom.com> wrote:
> 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.


What it does is map an input character into its corresponding equivalence
class. For example, if you build your scanner using the case-insensitive
flag (-i), then yy_ec['A'] == yy_ec['a'] == some small number identifying
their equivalence class. The equivalence class number is then what's used
to index the DFA state tables.


That said, the approach he outlines is still the correct one - translate
the table to reflect EBCDIC-based indices instead of ASCII ones.


> However, for this approach to work, you must tell flex to produce an 8
> bit scanner (the default is 7).


The default is now 8-bit, by the way (has been since flex 2.4).


Also: Mark Ganter (Mark_Ganter@liz.com) volunteered last year to serve
as the contact person for advice on porting Flex to EBCDIC (see the file
MISC/AS400 in the flex distribution) - you might drop him a line.


Vern
--


Post a followup to this message

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