This chapter defines Dyna’s concrete syntax.
Dyna’s syntax has both nested terms (also called recursive terms) and in-place evaluation. (Recall the discussion in Disposition.) Managing the details in a way that is (ideally) not too surprising to users requires some technical complexity.
Since this all takes place at parse time, the most upon which we can really expect to key our decisions is the term’s functor and arity. Each (functor,arity) pair may specify
Additionally, there are two explicit operators defined in the language:
When attempting to understand a term in a Dyna program, one must keep track of:
The interpretation is then the first matching row in this table:
Context | Eval Operators | Quoted? | Self | Effect |
---|---|---|---|---|
Any | 0 | Yes | Any | Quotation (explicit at site) |
Any | 0 | No | Quote | Quotation (implicit from self) |
Any | 0 | No | Evaluate | Evaluation (implicit from self) |
Quote | 0 | No | Inherit | Quotation (implicit from context) |
Evaluate | 0 | No | Inherit | Evaluation (implicit from context) |
Any | \(n > 0\) | Yes | Any | \(n\)-chained evaluation |
Any | \(n > 0\) | No | Evaluate | \((n+1)\)-chained evaluation |
Any | \(n > 0\) | No | Any | \(n\)-chained evaluation |
Where, by “\(n\)-chained evaluation”, we mean one evaluation of the term at hand, and then \(n-1\) indirect evaluations where the value is fed through the chart to obtain the next value. The last of these is taken to be the value of the chain as a whole. See spec-indirect-evaluation for more details.