编译原理与践 第三章 答案.docVIP

  • 12
  • 0
  • 约3.55万字
  • 约 7页
  • 2016-12-08 发布于河南
  • 举报
编译原理与践 第三章 答案

TheexercisesofChapterThree 3.2GiventhegrammarA→AA|(A)|ε a.Describethelanguageitgenerates; b.Showthatitisambiguous. [Solution]: a.Generatesastringofbalancedparenthesis,includingtheemptystring. b.parsetreesof(): AA A A A A ( ) ε ε A( A ( ) ε A 3.3Giventhegrammar exp?expaddopterm|term addop?+|- term?termmulopfactor|factor mulop?* factor?(exp)|number Writedownleftmostderivations,parsetrees,andabstractsyntaxtreesforthefollowingexpression: a.3+4*5-6 b.3*(4-5+6) c.3-(4+5*6) [Solution]: Theleftmostderivationsfortheexpression3+4*5-6: Exp=expaddopterm=expaddoptermaddopterm =termaddoptermaddopterm

文档评论(0)

1亿VIP精品文档

相关文档