Home  |   Notes  |   Languages  |   Programs  |   Homework

Re: grammar rules

New Message Reply About this list Date view Thread view Subject view Author view

Scott Schneider (scschnei@VT.EDU)
Tue, 25 Sep 2001 22:06:37 -0700


Message-ID:  <001201c14649$0e0e0000$0100a8c0@SCOTTSTOY>
Date:         Tue, 25 Sep 2001 22:06:37 -0700
From: Scott Schneider <scschnei@VT.EDU>
Subject:      Re: grammar rules

<expresson>
<additive_expr>
<term> + <term>
<factor> + <term>
3 + <term>
3 + <factor>
3 + 4

That's a left handed derivation according to the grammar rules, so that's
where 3 + 4 comes in. I think your confusion comes stems from that the
operators between the terms and factors are optional. Having the *, /, and
% nested deeper is what achieves the precedence rules.

Scott Schneider
scschnei@vt.edu

----- Original Message -----
From: "§ídësmâçk" <csides@VT.EDU>
To: <CS3304_91312@LISTSERV.VT.EDU>
Sent: Tuesday, September 25, 2001 6:36 PM
Subject: [CS3304_91312] grammar rules

> In the grammar rules, its states...
> <additive_expr> --> <term> { ( '+' | '-' ) <term> }
> <term> --> <factor> { ( '*' | '/' | '%' ) <factor> }
>
> I take this to mean that an add. expr is made of a term + or - another
term
> and a term is made of a factor * or / or % by another factor.
> If this is so, where does 3+4 fall? I can see that 3+4 is = to
> (3*1)+(4*1), but should we have to make that distinction?
> -Chris


New Message Reply About this list Date view Thread view Subject view Author view

Home  |   Notes  |   Languages  |   Programs  |   Homework
copyright © 2001 Virginia Tech, ALL RIGHTS RESERVED
Class site maintained by Stephen H. Edwards <edwards@cs.vt.edu>