Chapter 18. Syntax-Directed Translation

Translate source text by defining a grammar and using that grammar to structure translation.


Computer languages naturally tend to follow a hierarchical structure with multiple levels of context. We can define the legal syntax of such a language by writing a grammar that describes how elements of a language get broken down into subelements.

Syntax-Directed Translation uses this grammar to define the creation of a parser that can turn input text into a parse tree that mimics the structure of the grammar rules.

18.1 How It Works

If you’ve read any book on programming languages, you’ll have come across the ...

Get Domain Specific Languages now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.