Page 187 -
P. 187
170 Chapter 6 Architectural design
Translator
Source Check Syntax
Language Check Semantics
Instructions Generate
Abstract m/c
Instructions
Interpreter
Figure 6.18 The Fetch
architecture of a Data Execute Results
language processing
system
Of course, for many compilers, the interpreter is a hardware unit that processes
machine instructions and the abstract machine is a real processor. However, for
dynamically typed languages, such as Python, the interpreter may be a software
component.
Programming language compilers that are part of a more general programming
environment have a generic architecture (Figure 6.19) that includes the following
components:
1. A lexical analyzer, which takes input language tokens and converts them to an
internal form.
2. A symbol table, which holds information about the names of entities (variables,
class names, object names, etc.) used in the text that is being translated.
3. A syntax analyzer, which checks the syntax of the language being translated. It
uses a defined grammar of the language and builds a syntax tree.
4. A syntax tree, which is an internal structure representing the program being
compiled.
Symbol Table
Syntax Tree
Figure 6.19 A pipe and Lexical Syntactic Semantic Code
filter compiler Analysis Analysis Analysis Generation
architecture