home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.compilers
- Path: sparky!uunet!world!iecc!compilers-sender
- From: zell@curtiss.SEAS.UCLA.EDU (Adam W. Zell)
- Subject: DFA
- Reply-To: zell@curtiss.SEAS.UCLA.EDU (Adam W. Zell)
- Organization: Compilers Central
- Date: Tue, 15 Dec 1992 20:02:40 GMT
- Approved: compilers@iecc.cambridge.ma.us
- Message-ID: <92-12-073@comp.compilers>
- Keywords: lex, question, comment
- Sender: compilers-sender@iecc.cambridge.ma.us
- Lines: 24
-
- Just a quick question. When I used flex a while back, I defined a
- floating point number or integer as:
-
- number [0-9]
- exp [Ee][+-]?{number}+
- numtype {number}*\.?{number}+{exp}?
-
- While flipping through the 2nd edition of Lex and Yacc, they use the
- following definition:
-
- number [0-9]
- exp [Ee][+-]?{number}+
- numtype ({number}+|{number}*\.{number}+)({exp})?
-
- Is there any advantage in using the Lex and Yacc definition? Does it use
- fewer DFA states?
- [I don't see any compelling advantage either way, except that the first
- example works differently (worse) in AT&T lex because there's no parens
- around the {exp}. We did it the way we did because we wanted an example
- for the | operator and parenthesised patterns. Note that neither version
- accepts "123." which I'd call a bug. -John]
- --
- Send compilers articles to compilers@iecc.cambridge.ma.us or
- {ima | spdcc | world}!iecc!compilers. Meta-mail to compilers-request.
-