10.11 Chapter Summary

The main elements of an interpreter language implementation are:

  • a read-eval-print loop user interface (e.g., main_func)

  • a front end (i.e., scanner and parser, e.g., parser.parse)

  • an abstract-syntax data type (e.g., the expression data type TreeNode)

  • an interpreter (e.g., the evaluate_expr function)

  • supporting data types/structures and libraries (e.g., environment)

Figure 10.4 and Table 10.2 indicate the dependencies between the versions of Camille developed in this chapter, including the programming exercises. Table 10.3 summarizes the concepts and features implemented in the progressive versions of Camille developed in this chapter, including the programming exercises. Table 10.4 outlines the configuration options available in Camille for aspects of the design of the interpreter (e.g., choice of representation of referencing environment).

An illustration of dependencies between Camille interpreters.

Figure 10.4 Dependencies between the Camille interpreters developed in this chapter. The semantics of a directed edge ab are that version b of the Camille interpreter is an extension of version a (i.e., version b subsumes version a). (Key: circle = instantiated interpreter; diamond = abstract interpreter; ASR = abstract-syntax representation; CLS = closure; LOLR = list-of-lists representation.)

Description

Table 10.2 Versions of Camille (Key: ASR = abstract-syntax representation; CLS = closure; LOLR = list-of-lists representation.)

Version

Extends

Description

Chapter 10: Local Binding and Conditional Evaluation

1.0

1.1

1.1(named CLS)

1.2

1.2(named CLS)

1.2(named ASR)

1.2(named LOLR)

1.2(nameless CLS)

1.2(nameless ASR)

1.2(nameless LOLR)

1.3

N/A

1.0

1.1

1.1

1.2

1.2

1.2

1.2

1.2

1.2

1.2

simple, no environment

let, named CLS|ASR|LOLR environment

let, named CLS environment

let, if/else

let, if/else, named CLS environment

let, if/else, named ASR environment

let, if/else, named LOLR environment

let, if/else, nameless CLS environment

let, if/else, nameless ASR environment

let, if/else, nameless LOLR environment

let, let*, (named|nameless) (CLS|ASR|LOLR) environment

Table 10.3 Concepts and Features Implemented in Progressive Versions of Camille. The symbol ↓ indicates that the concept is supported through its implementation in the defining language (here, Python). The Python keyword included in each cell, where applicable, indicates which Python construct is used to implement the feature in Camille. The symbol ↑ indicates that the concept is implemented manually. The Camille keyword included in each cell, where applicable, indicates the syntactic construct through which the concept is operationalized. (Key: ASR = abstract-syntax representation; CLS = closure; LOLR = list-of-lists representation. Cells in boldface font highlight the enhancements across the versions.)

A table of concepts and data structures in different versions of Camille.
Description

Table 10.4 Configuration Options in Camille

Interpreter Design Options

Type of Environment Representation of Environment

named

nameless

abstract syntax

list of lists

closure

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.140.252.192