正在加载图片...
Dealing with Ambiguity There are two ways to remove ambiguity 1)Rewrite the grammar into a unambiguous grammar EE+T T TT*int int I(E) 口 Enforces precedence(优先级)of*over+ 口 Enforces left- associativity(左结合)of+and* 2) Declarations: instruct parser to pick desired parse trees a using %left, %right, %prec declarations7 Dealing with Ambiguity There are two ways to remove ambiguity: 1) Rewrite the grammar into a unambiguous grammar E E + T | T T T * int | int | ( E )  Enforces precedence(优先级) of * over +  Enforces left-associativity(左结合) of + and * 2) Declarations: instruct parser to pick desired parse trees  using %left, %right, %prec declarations
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有