[<<][staapl][>>][..]
Wed May 13 20:01:51 CEST 2009

interpreting generated code as a stack

Is this the essential difference compared to expression based partial
evaluation?

I.e. the Scheme form (+ a b) could be implemented as a macro + which
inspects its arguments, and performs an addition if it finds two
numbers.

In general (without the stack stuff) Staapl is a compiler for a
composition language : point free style -> imperative code.

It works on the analogy that machine code is actually a composition of
functions acting on the machine state.  This in itself is not so
useful when the only state that can be manipulated is the machine
state, but it is very useful when the state is somehow limited.

Using grids instead of stacks could lead to an APL like language.

I am missing something however.

I really don't want to operate on machine code.  I want typed lazy
values, not evaluated ones.

There are two problems I'm solving:

      [qw a] [qw b]    + -> [qw (+ a b)]
      [addlw a] [qw b] + -> [addlw (+ a b)]

The first one is generic, the second one is quite specific to the
machine.  Is it possible to implement partial evaluation in a more
direct style, without having to include specific clauses into each
machine-specific transformer?

There is one very big problem with my evaluator: it _needs_ to be
strict because it is intertwined with the implementation of the
run-time parameter stack.  This "side-effect" is OK as long as
parameter dereference doesn't get postponed and reordered.

Basicly, it's possible to delay the popping of the data stack and wrap
this action in a quoted macro, but then this popping fixes the order
in which these macros have to be evaluated.  I have a hunch that if I
can describe this problem in a proper way, I can find a solution and
move to a lazy evaluator.

However, when it is possible to use random parameter access, this
mechanism could be used to implement an evaluator for an applicative
language, essentially giving Luke's approach.

This stuff is over my head.  I just went over the rest of Thyer's
thesis and I'm quite confused.  The problem doesn't seem to be trivial
at all.


I keep coming back to "lazy pops".


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