正在加载图片...
Predictive Parser (example) stmt→if.… while ..... begin.… f0Y.… 。 When we are trying to write the non-terminal stmt,if the current token is if we have to choose first production rule. When we are trying to write the non-terminal stmt,we can uniquely choose the production rule by just looking the current token. We eliminate the left recursion in the grammar,and left factor it.But it may not be suitable for predictive parsing(not LL(1)grammar). CS308 Compiler TheoryPredictive Parser (example) stmt → if ...... | while ...... | begin ...... | for ..... • When we are trying to write the non-terminal stmt, if the current token is if we have to choose first production rule. • When we are trying to write the non-terminal stmt, we can uniquely choose the production rule by just looking the current token. • We eliminate the left recursion in the grammar, and left factor it. But it t b it bl f di ti i ( t LL(1) ) CS308 Compiler Theory 5 may no t be suit able for predi ctive pars ing (no t LL(1) grammar )
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有