正在加载图片...
Rewriting the grammar: what's the trick? Trick 1: Fixing precedence( computed before + EE+E IE*E I id/ a In the parse tree for id+ id *id, we want id*id to a Create a new nonterminal(m//t by be subtree of E+E. How to accomplisk-that rewriting make it deriⅳ eid*id, T|7 ensureS trees are nested in Es of E+E I ■ New grammarRewriting the grammar: what’s the trick? Trick 1: Fixing precedence (* computed before +) E E + E | E * E | id ◼ In the parse tree for id + id * id, we want id*id to be subtree of E+E. How to accomplish that by rewriting? ◼ Create a new nonterminal (T)  make it derive id*id, …  ensure T’s trees are nested in E’s of E+E ◼ New grammar: 9
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有