Analyzing operator syntax

I have a grammar that has the following works:

S-> if e , then S else | while e do S | start L end | s

L-> S; L | S

I have to build a parsing table of operator precedence for the above. But I am a little confused on how to resolve the priority of the different terminals here. So far we've worked on normal operators (like +, I, (, id, etc.). But how to solve this? I googled to find how to parse the if-else grammar with the operator precedence parser. but couldn't find any link explaining the same. I really need to develop error correction procedures to parse this grammar using operator precedence and SLR parser. Any help would be appreciated (question from Compiler Design book, Aho Ullman)!

Thanks in advance!

+3


source to share


1 answer


Answering my question for people looking to learn, read this pdf . It is a method for parsing according to operator precedence parsing for all common operators.



+1


source







All Articles