Mon May 6 12:16:44 EDT 2013
Why work on the stack level as opposed to the syntax level?
In Joy, the meaning function is a homomorphism from the syntactic
monoid onto the semantic monoid. That is, the syntactic relation of
concatenation of symbols maps directly onto the semantic relation of
composition of functions. It is a homomorphism instead of an
isomorphism because it is onto but not one-to-one, that is, some
sequences of symbols have the same meaning (e.g. "dup +" and "2 *")
but no symbol has more than one meaning.
How is this relevant for Staapl? The idea is that it is easier to
work with the semantic representation (functions) than the syntactic
I.e. instead of using term rewriting as the computation engine, one
uses function composition, which in practice is implemented as
directed rewriting, i.e. pattern matching.
The advantage here is to be able to encode machine-specific ideoms
(i.e. machine instructions) along side high level constructs.