Re: Regex -> DFA ->? Lex compiler

"Jonathan Barker" <>
10 Feb 2000 01:12:54 -0500

          From comp.compilers

Related articles
Regex -> DFA ->? Lex compiler (Paul Johnston) (2000-02-05)
Re: Regex -> DFA ->? Lex compiler (Armel) (2000-02-10)
Re: Regex -> DFA ->? Lex compiler (Jonathan Barker) (2000-02-10)
Re: Regex -> DFA ->? Lex compiler (2000-02-10)
| List of all articles for this month |

From: "Jonathan Barker" <>
Newsgroups: comp.compilers
Date: 10 Feb 2000 01:12:54 -0500
Organization: Easynet Group plc
References: 00-02-012
Keywords: lex, DFA


If your expressions are E1,E2,...,En, construct the expression

      e = (E1 #1) | (E2 #2) | ... | (En #n)

where #1,...,#n are unique symbols (not in the input alphabet).
Construct the DFA from this expression. Now any state of your DFA
which has a transition on #k (where k is one of 1,...,n) represents a
state in which a match of Ek has been seen.

You obviously enjoy figuring it out for yourself so I'll leave
out the rest of the details...


Paul Johnston <> wrote
> The problem I have now is that I am failing to translate a *set* of
> regular expression into a lexical analyzer (rather than just one
> regular expression).

Post a followup to this message

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