|Need help with grammars! email@example.com (1998-04-15)|
|Re: Need help with grammars! firstname.lastname@example.org (John Williams) (1998-04-21)|
|Re: Need help with grammars! email@example.com (Torben Mogensen) (1998-05-07)|
|From:||"John Williams" <firstname.lastname@example.org>|
|Date:||21 Apr 1998 00:42:02 -0400|
|Organization:||The University of Texas at Austin, Austin, Texas|
email@example.com wrote in message 98-04-064...
>lvalue ::= id | id [ exp ] | lvalue . lvalue
>exp ::= id ( functargs )
>exp ::= id [ arrayinit ]
>exp ::= lvalue
>exp ::= lvalue := exp
>exp ::= exp + exp
I don't have the experience to say for sure, but the distinction
between an lvalue and an rvalue mostly semantic, and trying to encode
it in your grammar rules will be more trouble and it's worth, assuming
it's possible at all.
(Someone call me on this if I'm wrong, since I'd like to know better
next time I try to write a parser :)
[You're right. Making distinctions semantically is often easier and
always lets you give better error messages, e.g. "expression where
variable name required" rather than "syntax error". -John]
Return to the
Search the comp.compilers archives again.