The Gateway to Computer Science Excellence
0 votes
Given an Operator Grammar as,

E -> E*F / F+E / F

F -> F-F / id

How to determine associativity in this case? Since Operator grammar can be ambiguous also.

Is the above question solved using associativity and precedence of operators we consider in C programming? or it is Different.
in Compiler Design by Active (4.3k points) | 647 views

1 Answer

0 votes
See recursive nature of the grammar.

If any production is left recursive then the associativity of operator will be left.

In case right recursive, the right associativity.

Also when parse tree is made, operator that comes at lower level has higher associativity like here - > * and  - > +.

If operands are same then generally +, *, - are left associative.
by (11 points)

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,648 questions
56,422 answers
99,823 users