Greets,
The porting of the Clownfish compiler to C has been underway for the last
several weeks. As previously discussed, this move was necessary in order to
replace the Perl-licensed CPAN module Parse::RecDescent with the public-domain
Lemon parser generator, written in C by SQLite author Richard Hipp.
Now that LEGAL-86 has finally been resolved favorably, usage of
Parse::RecDescent no longer blocks our 0.1.0-incubating release, taking some
of the urgency out of the task. Nevertheless, trunk/clownfish is in a
transitional state right now and I think it makes sense to push through to a
coherent stopping point.
The end goal is to have Clownfish entirely in C, as once that is done, it
eliminates the dependency for other Lucy host language bindings on Perl.
These are the stages of the transition:
1. *DONE* Migrate to an inside-out object model within the Clownfish
compiler internals. This makes it easier to move piecemeal from Perl
implementations to XS to C implementations.
2. *DONE* Eliminate sophisticated usage of polymorphism by Clownfish
compiler components, e.g. by rolling up many Type classes into one
module. In our C-based compiler, we can still use crude inheritance
based on struct layout and casting, but we don't want to require method
overriding if we can help it.
3. *UNDERWAY* Port primary Clownfish components to thin XS wrappers around C
implementations. This includes everything within trunk/clownfish/lib/
except the items under lib/Clownfish/Binding/ and lib/Clownfish/Parser.pm.
4. Port everything under trunk/clownfish/lib/Clownfish/Binding/ to XS
wrappers around C code.
5. Port Clownfish/Parser.pm to an XS wrapper around a C implementation using
Lemon.
6. Port all the test files in trunk/clownfish/t/ to C, using the test
harness code provided by Charmonizer.
7. Change the interface by which bindings are spec'd to e.g. parse static
JSON files rather than be invoked from Perl code, and change over all the
binding specs embedded within .pm files in trunk/perl/lib/ to use the new
interface.
8. Remove all Perl/XS from trunk/clownfish/.
In order to eliminate Parse::RecDescent as a dependency, we need to get
through stage 5, and that had been my previous goal for the 0.1.0-incubating
release. Now it seems to make sense to pause after either stage 3 or stage 4.
I look forward to completing all 8 stages, as once all the Perl code is
eliminated, it will make it easier for a larger Lucy community whose primary
expertise is in C to grok, to maintain and to write new host language
bindings.
Marvin Humphrey