[<<][staapl][>>][..]
Sat Apr 4 11:05:53 CEST 2009

machine specification

* The machine's namespace should be accessible partly.  I.e. if the
  machine has registers A B C, it should be possible to define an
  update using only a sumbset of the registers, with the other
  registers left untouched.

* Implementation of sequencing should be completely abstract (on the
  macro level).  This way it can later be changed from struct ->
  struct to values -> values to list -> list or whatever suits the
  needs.


So, what is necessary?

  NAMESPACE: some way of specifying the machine's namespace.  This
  could be implemented as a struct, list, vector, threaded values...
  This needs compile-time identifiers.

  UPDATE: parallel assignment defined for the abstract namespace.


Roadmap: first transform current machine's (i.e. in
comp/instantiate.ss and forth/parser-tx.ss to a transposed update
form, then replace with fixed namespace).  To do this, perform
automatic transformation of the state-lambda form in
staapl/scat/stack.ss

  1. trivial syntax-rules -> syntax-case
  2. pretty print old form for


Complications:

  * 'update is used explicitly in the state-lambda syntax, probably to
    allow for more flexible exit points.

  * pattern matching is used on the registers, so the name-based
    matching cannot be used, making the two mechanisms (machine
    namespace / positional binding + deconstruction) incompatible in
    the current form.


Example:


(define merge-store
  (state-lambda compiler
                 ('() ;; empty asm
                  (list-rest
                   (list asm rs (struct dict (current chain store)))
                   ctrl)
                  (struct dict (#f '() store+))
                  '()) ;; empty rs
                 (update asm
                         ctrl
                         (make-dict current chain
                                    (append store+ store))
                         rs)))

What about this form, annotated with some redundant visual marker syntax.

;; (field pattern expr)
((asm  :  '() -> asm)
 (ctrl :  (list-rest
           (list asm
                 rs
                 (struct dict
                         (current chain store)))
           ctrl)
          -> ctrl)
 (dict :  (struct dict
                  (#f '() store+))
          -> (make-dict current
                        chain
                        (append store+ store)))
 (rs   :  '() -> rs))


Advantage here is that it is immediately clear which registers are
modified.  A clause (r :) would mean (r : r -> r).

Now.. instead of using fn -> values, isn't it better to use tail
recursion (CPS) instead, and use delimited control to terminate a
sequence of operations?



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