Chapter 6.5.2.3 Confusion

35 views
Skip to first unread message

Kim EungKyun

unread,
Jan 7, 2019, 7:51:34 PM1/7/19
to PPP-public
In chapter 6.5.2.3, it states "any Expression starts with a Term and such a Term can be followed by a + or -."

But, looking at the grammar rule, an expression does not start with a term. It starts with an expression. 

Expression:
     Term
     Expression '+' Term
     Expression '-' Term

I would appreciate if someone could clear this up.
My guess is that it is because "every Term is an Expression, but not every Expression is a Term" (chapter 6.5.2.2), but I don't quite understand why not every Expression is a Term.

Thanks in advance. 

Art Werschulz

unread,
Jan 8, 2019, 8:30:00 AM1/8/19
to ppp-p...@googlegroups.com
On Jan 7, 2019, at 7:51 PM, Kim EungKyun <ek95...@gmail.com> wrote:

> In chapter 6.5.2.3, it states "any Expression starts with a Term and such a Term can be followed by a + or -."
>
> But, looking at the grammar rule, an expression does not start with a term. It starts with an expression.
>
> Expression:
> Term
> Expression '+' Term
> Expression '-' Term

Let's use the term "Addop" (additive operation) to mean + or -. The grammar says that an Expression is either a Term or has the form Expression Addop Term. Since a Term is a kind of Expression, the recursive part tells us that Term Addop Term is an Expression. Since Term Addop Term is an Expression, the recursive part now tells us that Term Addop Term Addop Term is an Expression. Continuing in this manner, we see that an Expression is a sequence of Terms, separated by Addops.

> would appreciate if someone could clear this up.
> My guess is that it is because "every Term is an Expression, but not every Expression is a Term" (chapter 6.5.2.2), but I don't quite understand why not every Expression is a Term.

For example: a+b is an Expression, but not a Term.

Art Werschulz
a...@comcast.net



Reply all
Reply to author
Forward
0 new messages