Operator precedence parsingOperator precedence grammar is kinds of shift reduce parsing method. It is applied to a small class of operator grammars. A grammar is said to be operator precedence grammar if it has two properties:
Operator precedence can only established between the terminals of the grammar. It ignores the non-terminal. There are the three operator precedence relations:a ⋗ b means that terminal "a" has the higher precedence than terminal "b". a ⋖ b means that terminal "a" has the lower precedence than terminal "b". a ≐ b means that the terminal "a" and "b" both have same precedence. Precedence table:Parsing Action
ExampleGrammar: Given string: Let us consider a parse tree for it as follows: On the basis of above tree, we can design following operator precedence table: Now let us process the string with the help of the above precedence table:
Next TopicLR Parser
|