Interpreter vs compiler



>>>>> "Stavros" == Stavros Macrakis <macrakis at alum.mit.edu> writes:

    >> I have thought about always translating Maxima's input into Lisp and
    >> then running the Lisp code, instead of interpreting the internal s-expr
    >> representation.

    Stavros> You could of course do this, but if you want to preserve current
    Stavros> Maxima semantics, in the absence of additional information
    Stavros> (declarations), you'd end up with simple things like f(x) being
    Stavros> translated to

    Stavros>        (let* ((xval (simplifya (if (boundp '$x) $x '$x))))
    Stavros>           (simplifya (if (fboundp '$f)         -- assuming all
    Stavros> functions are Lisp functions
    Stavros>                                  ($f xval)
    Stavros>                                  (list '($f) xval) )))

Hmm.  Not great, but at least the form could be "simplified" by some
macros or functions to handle the boilerplat stuff like determining if
something is boundp or fboundp.

[snip]

    Stavros> I suppose the advantage would be that you'd have a single code-base
    Stavros> for evaluation.  On the other hand, do you really want to debug
    Stavros> running code that looks like that?

No, of course not.  But you rarely need to debug the assembly output
from a C compiler either.  Unless you're the compiler writer, in which
case you might. :-)

But it seems my idea was not well thought out.  Good thing I didn't
try anything. :-)

Ray