Related articles |
---|
Regex -> DFA ->? Lex compiler johnston.p@worldnet.att.net (Paul Johnston) (2000-02-05) |
Re: Regex -> DFA ->? Lex compiler webid@asi.fr (Armel) (2000-02-10) |
Re: Regex -> DFA ->? Lex compiler jandk@easynet.co.uk (Jonathan Barker) (2000-02-10) |
Re: Regex -> DFA ->? Lex compiler torbenm@diku.dk (2000-02-10) |
From: | "Jonathan Barker" <jandk@easynet.co.uk> |
Newsgroups: | comp.compilers |
Date: | 10 Feb 2000 01:12:54 -0500 |
Organization: | Easynet Group plc |
References: | 00-02-012 |
Keywords: | lex, DFA |
Paul
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...
Jonathan
Paul Johnston <johnston.p@worldnet.att.net> 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).
Return to the
comp.compilers page.
Search the
comp.compilers archives again.