^/$ in lexical analyzers

goer@midway.uchicago.edu (Richard L. Goerwitz)
Sun, 27 Jun 1993 20:03:24 GMT

          From comp.compilers

Related articles
^/$ in lexical analyzers goer@midway.uchicago.edu (1993-06-27)
Re: ^/$ in lexical analyzers lord+@andrew.cmu.edu (Tom Lord) (1993-06-28)
Magic (was Re: ^/$ in lexical analyzers) goer@midway.uchicago.edu (1993-06-30)
Re: ^/$ in lexical analyzers mike@ichips.intel.com (1993-06-30)
| List of all articles for this month |

Newsgroups: comp.compilers
From: goer@midway.uchicago.edu (Richard L. Goerwitz)
Keywords: DFA, lex, question
Organization: University of Chicago
Date: Sun, 27 Jun 1993 20:03:24 GMT

I can see how ^ and $ regexps would be implemented using a stream-based
lexical analyzer. One just uses lookaheads and left contexts based on the
newline. What about a standard regexp package, though - i.e. one where
the object being scan- ned is simply a line? Situations like ^a|b would
seem a bit ugly, since there are no left contexts. Does one prepend a
character to the input stream, and modify the pattern (e.g. \na|\n.*b)?
Or does one use some ad hoc method?

Perhaps this question has an obvious answer. I've browsed through
standard works like the "Dragon Book," and found no- thing that is much
help (only the usual +,*,?, etc. get cov- ered).
      -Richard L. Goerwitz goer%midway@uchicago.bitnet
      goer@midway.uchicago.edu rutgers!oddjob!ellis!goer

Post a followup to this message

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