Basic Semantics




CS152

Chris Pollett

Mar. 2, 2009

Outline

Semantics

Attributes

Binding

The Basic Semantic Function

Semantic Functions in Compilers and Interpreters

Quiz

Which of the following is the correct way to define the type of a nonterminal called expr in Yacc assuming the %union had been set up correctly so that ival mapped to being an int?

  1. %token <ival> expr
  2. %nonterminal <ival> expr
  3. %type <ival> expr

Declarations

Blocks

More on Blocks

Other Language Constructs Supporting Declarations

Scope