Re: Speeding up LEX scanning times

"Virendra K. Mehta" <c1veeru@WATSON.IBM.COM>
Thu, 2 Feb 1995 18:06:41 GMT

          From comp.compilers

Related articles
Speeding up LEX scanning times pahint@eunet.be (1995-02-02)
Re: Speeding up LEX scanning times dimock@das.harvard.edu (1995-02-02)
Re: Speeding up LEX scanning times c1veeru@WATSON.IBM.COM (Virendra K. Mehta) (1995-02-02)
Re: Speeding up LEX scanning times monnier@di.epfl.ch (Stefan Monnier) (1995-02-03)
Re: Speeding up LEX scanning times mercier@hollywood.cinenet.net (1995-02-03)
Re: Speeding up LEX scanning times vern@daffy.ee.lbl.gov (1995-02-04)
Re: Speeding up LEX scanning times eifrig@beanworld.cs.jhu.edu (1995-02-07)
| List of all articles for this month |

Newsgroups: comp.compilers
From: "Virendra K. Mehta" <c1veeru@WATSON.IBM.COM>
Keywords: Cobol, parse, lex
Organization: Compilers Central
Date: Thu, 2 Feb 1995 18:06:41 GMT

[ Pieter Hintjens penned : ]
[Scanning Cobol in lex is slow, how should I speed it up?]


COBOL lexical analyzers can be pretty slow because of the very complicated
regular expressions involved. In my case, I had a lot of complex classes for
example for the argument to PIC etc. These generate a sizable dfa and can slow
the scanner down a lot. Tackling the fixed format and handling identifiers
that can be in any case but mean the same can add to scanner time.


I had to strip out a lot of things from lex regular expressions and recognize
them separately. Ironically, it is these very expressions that are supposed to
be coded in lex to avoid too much coding. Also I had a preprocessor to take
care of the format, comments etc. It also used to convert all characters
outside of quotes to upper case. This solution amounts to a dual pass and the
total time may be same, but parsing alone can be faster.


--
Virendra K Mehta | IBM T J Watson Research Centre
c1veeru@watson.ibm.com | (914) 784-7774
viren@wipsys.soft.net |
--


Post a followup to this message

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