|Why context-free? firstname.lastname@example.org (2005-10-06)|
|Re: Why context-free? cfc@shell01.TheWorld.com (Chris F Clark) (2005-10-07)|
|Re: Why context-free? email@example.com (2005-10-07)|
|Re: Why context-free? firstname.lastname@example.org (Russ Cox) (2005-10-07)|
|Re: Why context-free? bobduff@shell01.TheWorld.com (Robert A Duff) (2005-10-07)|
|Re: Why context-free? email@example.com (2005-10-08)|
|Re: Why context-free? firstname.lastname@example.org (2005-10-08)|
|Re: Why context-free? email@example.com (glen herrmannsfeldt) (2005-10-09)|
|Re: Why context-free? firstname.lastname@example.org (2005-10-09)|
|Re: Why context-free? email@example.com (2005-10-09)|
|Re: Why context-free? firstname.lastname@example.org (Robert Figura) (2005-10-10)|
|Re: Why context-free? email@example.com (Ivan Boldyrev) (2005-10-10)|
|Re: Why context-free? firstname.lastname@example.org (Tony Finch) (2005-10-13)|
|[20 later articles]|
|Date:||8 Oct 2005 17:28:11 -0400|
|Posted-Date:||08 Oct 2005 17:28:11 EDT|
Just a curious question : Some time back one of we had a similiar
question to which one of my classmates was telling us that
(1) Regular grammars are not sufficient for generating programming
languages since in most of the PLs we need matching procedure
call-return structures, many balanced structures for statements like
if-then-else etc which a PDA can easily keep track of.
(2) Well known parsing algorithms are known to exist for CFLs.
One important thing he was saying was that some constraints like 'The
type associated with the use of variable in an expression should
always match with it's declared type' can't be expressed within a CFG
itself ( although it can be achieved using attributes attached during
syntax-directed translation ). Also he was saying that a
context-sensitive grammar could express these kinds of constraints.
Is the above assertion true ? If so, wouldn't using CSGs be more
helpful for purposes like type checking etc ?
[See my notes about two messages ago. Yes, you can build the types into
the grammar by using context sensitivity, but no, it's not usually a
good idea because it ruins the diagnotstics. Use attributes. That's
what they're for. -John]
Return to the
Search the comp.compilers archives again.