Slide 3.5: Abstract syntax trees
Slide 4.2: Syntax-directed translation
Home

Translational Semantics


The idea of translational semantics is to express the meaning of a language by a translation schema which, for any program in the language, yields a program in a simpler and, it is hoped, better understood language. For example, compilers perform a translation of a high-level language into a low-level language. Executing this target program on a computer captures the semantics of the program in a high-level language.


The figure below illustrates the idea of translational semantics. The bottom half of the figure (“Execution”) is outside of the semantic specification proper; it shows how the semantic function, applied to a source program, yields a target program which, if run on input data, will yield results.


Attribute grammars can be used to translate a programming language into a machine-oriented language. Translational semantics is based on two notions:
  1. The semantics of a programming language can be preserved when the language is translated into another form, called the target language.

  2. The target language can be defined by a small number of primitive constructs that are closely related to an actual or a hypothetical machine.