Pantagruel v0.0.7 Pantagruel.Eval View Source

Evaluation of a Pantagruel program.

Evaluation of a Pantagruel AST consists of walking the tree, binding any symbols that are introduced in binding forms (function declarations, quantifiers, domain aliases), and checking that all symbols have been properly bound.

Link to this section Summary

Types

t()

A Pantagruel AST is a sequence of sections, each of which consists of a header and optional body

Functions

Evaluate a Pantagruel AST for variable binding, returning the resulting environment of all bound symbols

Link to this section Types

A Pantagruel AST is a sequence of sections, each of which consists of a header and optional body.

The state of a running Pantagruel program as of any section consists of three elements:

  • The execution environment, a list of scopes, one for each section. The head of the environment corresponds to the current section. At any given section, any symbol introduced in that section will be bound into the scope at the head of the environment.

  • The header symbols to check for boundness. Any symbol used in a section header that is not in a declaration position is included here to be checked for boundness. Every symbol used in a header must be bound by the end of that header.

  • The body symbols to check for boundness. Any symbol used in a section body that is not in a declaration position is included here to be checked for boundness. Every symbol used in a body must be bound by the end of the following body. Unlike with headers, symbols may be referred to before they are defined, but they must be defined in the following section at the latest.

Link to this section Functions

Evaluate a Pantagruel AST for variable binding, returning the resulting environment of all bound symbols.