0

I'm trying to clarify the following about context-free grammar:

If I've got the following,

S->T0T

If there are two possible values for T ie.

T-> 1T | 1

Do I have to use the same value when substituting both Ts, like so:

T0T becomes (1T)0(1T) => 1T01T

Or can I use different values for each T, like so:

TOT becomes (1T)0(1) => 1T01
Harry Wright
  • 182
  • 2
  • 10

1 Answers1

1

There is no relationship between the two Ts. The restriction that they had to be the same would make the grammar not context-free, since the replacement of T in a context-free grammar is independent of the context. Hence "context-free".

rici
  • 234,347
  • 28
  • 237
  • 341