CSCE 314 Lecture 23

From Notes
Jump to navigation Jump to search

« previous | Wednesday, October 19, 2011 | next »


Type Checking

Context-free grammars cannot catch type errors (e.g. whether the conditional expression within an if-statement will evaluate to a Boolean).

CF grammars cannot tie a variable to its definition. Type-checker makes sure that the AST nodes' types match what the language/program requires.

Assigning types:

  • We say "expression t is of type T"
  • Notation is
    • , where Γ is the context or typing environment
    • Haskell uses t :: T