Syntax-Directed TranslationPart I.pptVIP

  • 5
  • 0
  • 约8.45千字
  • 约 31页
  • 2017-05-14 发布于江苏
  • 举报
Syntax-Directed TranslationPart I.ppt

求职应注意的礼仪 求职时最礼貌的修饰是淡妆 面试时最关键的神情是郑重 无论站还是坐,不能摇动和抖动 对话时目光不能游弋不定 要控制小动作 不要为掩饰紧张情绪而散淡 最优雅的礼仪修养是体现自然 以一种修养面对两种结果 必须首先学会面对的一种结果----被拒绝 仍然感谢这次机会,因为被拒绝是面试后的两种结果之一。 被拒绝是招聘单位对我们综合考虑的结果,因为我们最关心的是自己什么地方与用人要求不一致,而不仅仅是面试中的表现。 不要欺骗自己,说“我本来就不想去”等等。 认真考虑是否有必要再做努力。 必须学会欣然面对的一种结果----被接纳 以具体的形式感谢招聘单位的接纳,如邮件、短信 考虑怎样使自己的知识能力更适应工作需要 把走进工作岗位当作职业生涯的重要的第一步,认真思考如何为以后的发展开好头。 Thank you Syntax-Directed Translation Part I Chapter 5 The Structure of our Compiler Revisited Syntax-Directed Definitions A syntax-directed definition (or attribute grammar) binds a set of semantic rules to productions Terminals and nonterminals have attributes holding values set by the semantic rules A depth-first traversal algorithm traverses the parse tree thereby executing semantic rules to assign attribute values After the traversal is complete the attributes contain the translated form of the input Example Attribute Grammar Example Annotated Parse Tree Annotating a Parse Tree With Depth-First Traversals Depth-First Traversals (Example) Attributes Attribute values may represent Numbers (literal constants) Strings (literal constants) Memory locations, such as a frame index of a local variable or function argument A data type for type checking of expressions Scoping information for local declarations Intermediate program representations Synthesized Versus Inherited Attributes Given a production A ? ? then each semantic rule is of the form b := f(c1,c2,…,ck) where f is a function and ci are attributes of A and ?, and either b is a synthesized attribute of A b is an inherited attribute of one of the grammar symbols in ? Synthesized Versus Inherited Attributes (cont’d) S-Attributed Definitions A syntax-directed definition that uses synthesized attributes exclusively is called an S-attributed definition (or S-attributed grammar) A parse tree of an S-attributed definition is annotated with a single bottom-up traversal Yacc/Bison only support S-attributed definitions Example Attribute Grammar in Yacc Bottom-up Evaluation

文档评论(0)

1亿VIP精品文档

相关文档