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]
|
|
0
|
|
|
|
Reply
|
mwarehime (1)
|
12/9/2007 11:08:49 PM |
|
On Dec 10, 1:08 am, "Mike Warehime" <mwareh...@comcast.net> wrote:
> 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 C or C++ code. ...
I wrote an article for GameDev some years ago about a regex engine. It
features a section on Thompson's construction, with C++ code:
http://www.gamedev.net/reference/articles/article2131.asp
|
|
0
|
|
|
|
Reply
|
eliben
|
12/10/2007 7:04:05 AM
|
|
Mike Warehime wrote:
> 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 C or 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.
Hello Mike,
I would advise you the book "Compiler Construction in C" by Allen I.
Holub [Prentice-Hall Software Series], ISBN 978-0131550452. It comes
with complete source code and explains them for Lex- and Yacc-like
tools. Also my own project JS/CC [http://jscc.jmksf.com] implements
Thompson's Algorithm using the way Holub implements it.
You can even download the sources of the book at
http://www.holub.com/software/compiler.design.in.c.html .
Best regards
Jan Max
[If you do get a copy of the book, be sure also to get a copy of the
errata. The early printings had a stupendous number of errors, many
quite serious. -John]
|
|
0
|
|
|
|
Reply
|
mailings
|
12/10/2007 6:18:33 PM
|
|
|
2 Replies
243 Views
(page loaded in 0.006 seconds)
Similiar Articles: Implementing Thompson's construction - comp.compilersHello, 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 i... NFA to DFA implementation - comp.compilersImplementing Thompson's construction - comp.compilers... smaller but I don't know what to do for the nfa. ... anything on any platform I want to write a dfa table ... cch federal taxation 2011 smith, harmelink hasselback - comp.soft ...... in Java 2e Mark Allen Weiss SM Source code Database Design and Implementation ... Implementing Thompson's construction - comp.compilers cch federal taxation 2011 smith ... Dividing a table in to smaller tables - comp.soft-sys.sas ...Implementing Thompson's construction - comp.compilers Dividing a table in to smaller tables - comp.soft-sys.sas ... Implementing Thompson's construction - comp.compilers I ... Solution Manual and Test Bank - comp.arch.embedded... Your Financial Future Boone 4 -Portfolio Construction ... Systems A Practical Approach to Design, Implementation and ... MATLAB By L. F. Shampine, I. Gladwell, S. Thompson ... Largest Collection Of Solutions Manuals & Test Banks Over The Net ...... and Leadership, 3rd Edition, Schein, Instructor's ... 2009, Wood, Wood, Boyd, Test Bank Portfolio Construction ... Bank Science of Nutrition, 2nd Edition 2011, Thompson ... Test Banks & Solutions Manual - comp.lang.java.programmer ...... Cormen, Leiserson, Rivest, Stein, Instructor's ... Brien, Test Bank Making the Team, 3rd Edition, Thompson ... Chabay, Sherwood, Test Bank MCSE Guide to Implementing and ... All Solutions Manuals & Test Banks Are HERE (Just click)!!!!! #4 ...... 5th Edition, August, Mayer, Bixby, Instructor's ... Wood, Solutions Manual Introductory Physics: Building ... Woestman, Test Bank Making the Team, 3rd Edition, Thompson ... Test Banks & Solutions Manual - comp.lang.java.programmer ...... Edition, Joehnk, Gitman, Test Bank Planning_Implementing ... An Introduction to Sociology, 6th Edition, Thompson ... of Materials for Architecture and Building Construction ... Is there a better way to do this? - comp.lang.java.help-- Andrew Thompson http://www.athompson.info ... It's not the best practice to discard ... Have your ever been frustrated building something and mumbled to yourself, "There's got ... Implementing Thompson's construction - comp.compilers | Computer GroupHello, 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 i... Implementing Thompson's construction - Application Forum at ...Implementing Thompson's construction - Compilers . This is a discussion on Implementing Thompson's construction - Compilers; Hello, I have read the red dragon book ... 7/26/2012 11:13:51 PM
|