1,351 views
1 votes
1 votes

In operator precedence parsing we have the rule that production cannot have two adjacent non-terminals or an epsilon production, so this production, S--> ab is allowed but not S--> AB, A->a and B->b, though they are giving us the same output. Why so?

2 Answers

3 votes
3 votes

Rule of Operator precedence Parser is Any two variable should not adjacent to each other.If they are adjacent to each other then convert it!

eg- In C compiler,no two variables are adjacent 

            ab!=a*b this is not allowed in our c compiler

0 votes
0 votes
because for first grammar: S→ ab( adjacent terminals) is an operator grammar

but the second one is S->AB,  A->a, B->b (adjacent non-terminals (AB)) is not operator grammar (Yes we all know that we can make it operator grammar by replacing A and B’s Value in S but first hand  it is an non-operator grammar, So we can’t make its Relation Table).

Related questions

0 votes
0 votes
1 answer
1
saumya mishra asked Jun 15, 2018
2,208 views
What is the difference between operator grammar and operator precedence grammar?
2 votes
2 votes
0 answers
2
junaid ahmad asked Nov 16, 2017
895 views
Can anyone explain why operator precedence parsing cannot handle unary minus,and what are the approach to handle it.
0 votes
0 votes
5 answers
3
AnilGoudar asked Sep 18, 2017
2,185 views
In Operator precedence parsing, precedence relations are defined,i. for all pair of non-terminals.ii. for all pair of terminals.iii. to delimit the handle.iv. only for ce...
0 votes
0 votes
1 answer
4
jatin khachane 1 asked Jun 7, 2017
499 views
E → E + E | E * E | ( E ) | idWhat will be operator precedence for above grammar.Is precedence differs due to ambiguity