[pypy-dev] scheme interpreter [status report]

Jakub Gustak jgustak at gmail.com
Fri Aug 17 14:35:20 CEST 2007


This is last scheme status report during SoC. So I will sum things up
in the end.

> Macros looks like working.
> One thing to be added: they are acting like first-class objects, but should not.

Found a bug, when ellipsis matched zero objects, fized now.
Scheme48 acts differently in some cases. On the other hand in this
cases mzScheme works just as expected.
In this meaning macros are evil. There is no explicit specification
how they should behave in r5rs. They look like added to the
specification in last minute.

Continuations:

> Another issue: this implementations is stack-only so it introduce lot
> of overhead both on capturing and throwing continuations.
>
> And one more: every W_Procedure is continuations-safe but VERY slow,
> even when no capture occurs.

I made them a little faster by decreasing number of operations, but
still for every non-tail-call a new instance of ContinuationFrame is
created and is stored on stack. On every return it is popped form
stack and forgotten.
When no capture will happen, it is time and memory waste.

> I'd rather would like to think about how to throw continuations more
> generally, and not have to implement continue_tr for every W_Callable,
> than implementing capture differently.

No progress in this direction.
Still every W_Callable to be continuations friendly has to use eval_cf
instead of eval and must implement continue_tr method.

> Or maybe try totally different approach e.g write every call in CPS,
> but it probably would require way too much changes right now.

Nor here.

Summarization:
* Interactive interpreter (not RPythonic) lang/scheme/interactive.py
* Can be translated using: translation/goal/targetscheme.py

PyPy Scheme Interpreter features:
* uses rpythonic packrat parser
* every "syntax" definitions are implemented
* quotations and quasi-quotations
* delayed evaluation
* proper tail-recursion
* hygienic macros
* partly working continuations (some macros are not continuations friendly yet).
  * no dynamic-wind procedure

Known issues and "to be added":
* lambda does not check if it is called with correct arguments number
* macros are acting like first-class objects, though they shouldn't
* missing input/output procedures
* no support for chars, vectors
* strings are supported, but no string-operations procedures
* quite a few procedures are missing, but they can be easily added
* no call-with-values and values
* missing some "library syntax", can be defined using macros

What's next?
I will probably mysteriously disappear and became grave-digger or
hermit. Never touch computer again and live happily ever after ;-).

Cheers,
Jakub Gustak



More information about the Pypy-dev mailing list