Re: Grammar -> Parser question

"Quinn Tyler Jackson" <qjackson@wave.home.com>
9 Jun 1998 12:05:34 -0400

          From comp.compilers

Related articles
Grammar -> Parser question chris63@my-dejanews.com (1998-06-04)
Re: Grammar -> Parser question td@sysinno.se (Torbjorn Drevin) (1998-06-09)
Re: Grammar -> Parser question torbenm@diku.dk (Torben Mogensen) (1998-06-09)
Re: Grammar -> Parser question dwight@pentasoft.com (1998-06-09)
Re: Grammar -> Parser question qjackson@wave.home.com (Quinn Tyler Jackson) (1998-06-09)
Re: Grammar -> Parser question qjackson@wave.home.com (Quinn Tyler Jackson) (1998-06-18)
| List of all articles for this month |
From: "Quinn Tyler Jackson" <qjackson@wave.home.com>
Newsgroups: comp.compilers
Date: 9 Jun 1998 12:05:34 -0400
Organization: Compilers Central
References: 98-06-018
Keywords: parse, comment

>Suppose I have the following Grammar:
>
>condition -> expr PLUS expr |
> LPAREN condition RPAREN
>
>expr -> ID |
> LPAREN expr RPAREN
>
>However, the LPAREN symbol is causing a problem: When I see it, I don't
>know if I'm dealing with a nested condition or a nested expression.
>
>How does one typically deal with this situation if one has to hand-code
>the parser? It looks like I need some sort of lookahead and/or backtracking
>mechanism so I can figure out which case I am dealing with.


What's the real difference between a "condition" and an "expression?"


Isn't a "condition" simply an expression that solves to non-zero, or is
there some reason that this is not the case with the grammar in question?


Cheers,


Quinn
[Not all languages are C. Many languages have boolean variables and
boolean values separate from arithmetic values. -John]
--


Post a followup to this message

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