[parenscript-devel] Big compiler refactoring done.
Vladimir Sedach
vsedach at gmail.com
Sun Aug 12 01:56:05 UTC 2007
Hello everybody,
I just finished pushing the compiler refactoring patch that I
mentioned earlier. The big change is that now the intermediate
ParenScript representation is just s-expressions instead of CLOS
objects, which provides several benefits: the intermediate code is now
much easier to manipulate and to write code walkers for, which should
make things like optimization passes easier to write, it is easily
inspectable and serializable, which enables easier debugging and unit
testing (I plan to add unit tests for the compiler and the printer now
that they have been decoupled). The other big change that accompanies
this is that the decision whether to produce expression or statement
code has been pushed from the printing code to the actual compiling
code, which makes the aforementioned code walkers even more practical.
This has also had the effect of simplifying the printing interface
considerably (from three functions down to one).
The other changes I made are removing the last of the namespace
functions, and the compilation environments. In the place of the
namespace code is a mechanism that associates Lisp packages with a
string prefix: any symbol in that package is printed with that prefix.
I think that unless there are requests for further namespace
functionality, that's really all that is necessary for most use cases
(avoiding name clashes). The compilation environment and toplevel code
I have removed because I feel that the eval-when functionality can be
provided in a better way by just using Lisp code, and also to simplify
the compiler interface (it's now down to one function from three) and
implementation (which, although much simpler now, I think still has
some room for improvement).
On a more (or less?) controversial note, I have renamed all the
foo-script-blah functions to be foopsblah (except for
compile-script-form, which is now compile-parenscript-form). I've come
to a pretty definite conclusion that it's not only clearer but also
saves considerable typing.
The next course of action I'm planning is to rewrite the way printing
is done to simplify things, and correct the currently wonky
indentation (a part of the decision for how to indent blocks was done
by the compiler code previously, and of course this is currently
gone). Once the rewrite is done, I'm planning to update the
documentation, fix the deprecated interface, and then make a release.
Happy hacking,
Vladimir
More information about the parenscript-devel
mailing list