edited by
1,117 views

2 Answers

2 votes
2 votes

In your 1st line you have written  EF→E∗F  ..  EF !!   typing error? If it is edit it.

Next . coming to whatever you have written in big fonts.

E -> E*F | F+E | F

F -> F - F | id

* & + are at same level so their precedence is same.
' - ' has more precedence than * & +  because it is more close to leaf in parse tree...

Rule is simple. The operator more close to leaf will be evaluated first so it has highest precedence, operator at root has least precedence. If they are in same level, they have same precedence.

2 votes
2 votes
- is having higher precedence than both * and +.

The highest precedence operator is placed farther from the start symbol of the CFG as it has to be evaluated first.

* and + have the same precedence as they are at the same level.

Related questions

1 votes
1 votes
2 answers
1
Hirak asked Jun 14, 2019
1,341 views
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 ...
0 votes
0 votes
1 answer
3
saumya mishra asked Jun 15, 2018
2,197 views
What is the difference between operator grammar and operator precedence grammar?
2 votes
2 votes
0 answers
4
junaid ahmad asked Nov 16, 2017
889 views
Can anyone explain why operator precedence parsing cannot handle unary minus,and what are the approach to handle it.