Implementing Thompson's construction

"Mike Warehime" <mwarehime@comcast.net>
Sun, 9 Dec 2007 18:08:49 -0500

          From comp.compilers

Related articles
Implementing Thompson's construction mwarehime@comcast.net (Mike Warehime) (2007-12-09)
Re: Implementing Thompson's construction eliben@gmail.com (eliben) (2007-12-09)
Re: Implementing Thompson's construction mailings@jmksf.com (mailings@jmksf.com) (2007-12-10)
| List of all articles for this month |

From: "Mike Warehime" <mwarehime@comcast.net>
Newsgroups: comp.compilers
Date: Sun, 9 Dec 2007 18:08:49 -0500
Organization: Compilers Central
Keywords: lex
Posted-Date: 09 Dec 2007 20:56:15 EST

Hello,


I have read the red dragon book and I understand the algorithms and
how they work. But I am not real good at turning Thompson's
construction into Cor C++ code. I think my mental block is happening
when I try to think about how to incorporate transition and epsilon
transitions into data structures. I understand how to recursive
descent parse a regular expression and have built parse trees for the
regular expressions. Bu there is something I just don't get. I want
to use a lookup table for the transition characters to keep the tables
a little smaller but I don't know what to do for the nfa.


I have dissected the source for flex quite thoroughly, and I find it a
real mess but very convenient to use. Being able to use #define for
almost anything and it works for almost anything on any platform


I want to write a dfa table out and simulate a dfa on input and use it
in a iostream for tokenizing. I don't want or need a flex scanner. Too
much power. Too much complexity. But maybe, I just don't understand.
My goal is to write the dfa out into spaghetti code that does the
lexical analysis from a list of regular expressions.


Mike Warehime
[You might like re2c. -John]



Post a followup to this message

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