Why separate Lexical & Parser Generators

John Heron <heronj@smtplink.NGC.COM>
Wed, 5 Oct 1994 01:30:49 GMT

          From comp.compilers

Related articles
Why separate Lexical & Parser Generators heronj@smtplink.NGC.COM (John Heron) (1994-10-05)
Re: Why separate Lexical & Parser Generators andand@csd.uu.se (Anders Andersson) (1994-10-06)
Re: Why separate Lexical & Parser Generators leichter@zodiac.rutgers.edu (1994-10-06)
Re: Why separate Lexical & Parser Generators morrison@hal.cs.uiuc.edu (1994-10-07)
Why separate the lexer and parser? mark@omnifest.uwm.edu (Mark Hopkins) (1994-10-09)
Re: Why separate Lexical & Parser Generators johnl@cs.indiana.edu (John Lacey) (1994-10-10)
Re: Why separate Lexical & Parser Generator steve@cegelecproj.co.uk (1994-10-10)
[12 later articles]
| List of all articles for this month |

Newsgroups: comp.compilers
From: John Heron <heronj@smtplink.NGC.COM>
Keywords: lex, yacc, question, comment
Organization: Compilers Central
Date: Wed, 5 Oct 1994 01:30:49 GMT

Pardon me if this question is naive. Why have a separate parser generator
and lexical analyzer generator? It seems to me that the generator could
recognize the regular portions of the grammar by starting at the terminal
symbols and working its way up until it sees a non-regular production.
After separating the grammar into 2 parts, one regular and one
context-free, you could proceed to build 2 separate FSM's. Are we still
using separate tools like yacc and lex just because they're widely
available, and widely understood? Or is there some other technical,
engineering, or business reason for doing things the traditional way?


***** John Heron, Network General Corp. - email - johnhe@ngc.com
[The short answer is that they do different things. There are lots of places
where lex is useful without yacc, and some where yacc is useful without lex.
Also, if you think it'd be easier to write one big grammar, try writing the
BNF for a language, including indicating all the places where you can have
comments. Don't forget to make provisions for tracking line numbers, too.
-John]
--


Post a followup to this message

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