[<<][staapl][>>][..]
Fri May 23 14:04:35 CEST 2008

Explicit instantiation and macro assignment.

EDIT: comes from blog, now degraded to a rambling because it's
confusing given i'm embracing 3 level code now (word,macro,parser)

There is one pattern that is cumbersome to express at this moment:
   * Write logic as macros without specifying concrete names.
   * Provide names during instantiation.

If this is about creating a single function or macro, it's straightforward:

  : interpreter
      ' receive
      ' transmit
     compile-interpreter ;

Because the .f syntax at this moment assumes that all macros occur in
isolated (macro . code) pairs it is not possible to define a
collection of functions/macros.

What is desired is something like:

   ` read ` write create-io

Which requires some form of mutation, even if it's single
assignment. Alternatively parsing words preprocessors could be used:

   create-io read write

To expand to

   :macro read make-io-read ;
   :macro write make-io-write ;

This requires a special purpose syntax, i.e. something like

   parser create-io read write ==
      :macro read make-io-read ;
      :macro write make-io-write ;
   end

The problem with this is that parser generating parsers are hard to
express. Is it possible to create a single abstraction that does not
limit the number of orders? It looks like programmable parsers are
necessary anyway when macros can't deal with identifiers.

The good thing about using the previous approach is that it maps very
well to Scheme's define and define-syntax.


TODO: place this in the framework of compilation phases and figure out
a better syntax for defining parser macros.






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