Related articles |
---|
Q2. Why do you split a monolitic grammar into the lexing and parsing r spam@abelectron.com (valentin tihomirov) (2005-02-20) |
Re: Q2. Why do you split a monolitic grammar into the lexing and parsi vidar@hokstad.name (Vidar Hokstad) (2005-02-28) |
Re: Q2. Why do you split a monolitic grammar into the lexing and parsi Ron@xharbour.com (Ron Pinkas) (2005-02-28) |
Re: Q2. Why do you split a monolitic grammar into the lexing and parsi mefrill@yandex.ru (2005-02-28) |
Re: Q2. Why do you split a monolitic grammar into the lexing and parsi ndrez@att.net (Norm Dresner) (2005-02-28) |
Re: Q2. Why do you split a monolitic grammar into the lexing and parsi rh26@humboldt.edu (Roy Haddad) (2005-03-04) |
From: | "Norm Dresner" <ndrez@att.net> |
Newsgroups: | comp.compilers |
Date: | 28 Feb 2005 00:51:51 -0500 |
Organization: | AT&T Worldnet |
References: | 05-02-087 |
Keywords: | lex |
Posted-Date: | 28 Feb 2005 00:51:51 EST |
"valentin tihomirov" <spam@abelectron.com> wrote in message
> Looks like this is a group discussing parsing-translating issues as
> a matter of compiler front-ends. So, the problem is to enable using
> reserwed keywords as identifiers. ....
> So, I do not understand why do we need the artificial obstacle, the
> 2nd level?
> [Try writing a single-level parser that disregards spaces and
> optional spaces in the usual way. A separate lexer makes that a
> whole lot easier. -John] >
The answer to your subject question for me is "to reduce complexity".
There was (many years ago) a tradition in modular programming that no
function should be longer than a single printed page. It is a good
measure of what an ordinary human can comprehend easily. Well, we
(almost never) use printed pages anymore and my rule is that a
function shouldn't be longer than a few screens. Applying the same
principle to grammars, once a grammar gets beyond a certain point in
complexity it's easier to comprehend what's going on (and much easier
to find problems) if there's a split into the lexical and syntactical
halves -- at least for me.
Norm
Return to the
comp.compilers page.
Search the
comp.compilers archives again.