[<<][staapl][>>][..]
Sat Mar 20 13:46:29 CET 2010

Adding static semantics to macros

I'm trying to get an idea of Ziggurat[1] from the JFP paper (no public
link).  Before trying to explain that approach, I'm going to walk
around in ignorance for a bit, and see what I can write down.

A macro is a compiler:

        code -> code'

A typed macro is a compiler together with a (static) interpreter.

        code -> fun
      = code -> data -> data'

The idea is that before (or interleaved with) compilation, some
interpretation is performed on the code to see whether it has certain
properties, without executing it completely.  I.e. one performs an
abstract interpretation.

( Note that the basic unit of interpretation doesn't need to be the
same for code and data. I.e. type checking/inference can span over
multiple functions in a module, while functions are typically isolated
in behaviour. )

Summary:

        The main idea is that there is _both_ compilation and
        interpretation going on.


Ok, now the paper.

* The basic idea is delegation of behaviour.  In terms of syntax
  objects this is semantics: how to interpret.  A syntax object can
  provide its own meaning, or delegate to the syntax it expands into.

* The "lazy" part is there to break a possible circularity.
  Delegation depends on expansion (macro use time) and is not knowable
  at macro definition time.


[1] http://lambda-the-ultimate.org/node/3179



[Reply][About]
[<<][staapl][>>][..]