I still have the single pass (that is, no eval) tcl to pasm parser/compiler that I wrote in perl5. I had only defined a few commands (append, exit, puts, and set, with a broken incr (were missing a PMC method at the time, and a partial if), but the parsing algorithm is already done.

I had meant to follow jako and have it generate imcc instead (which would allow me to easily do a lot of the stuff I was doing manually), and in fact have the parsing in imcc or pasm (for eval), but haven't gotten that far yet. Pesky life.

Regards.

Dan Sugalski wrote:
At 9:12 AM -0500 12/17/02, David Robins wrote:

On Tue, 17 Dec 2002, K Stol wrote:

After doing some reading about Parrot, I got very interested. I'd like to
write some kind of compiler for my Bacherlor's in Computer Science. I'm
thinking of a compiler for Tcl which produces Parrot Assembly code, but
the source language (which will be compiled) is not definite yet.

I have basic knowledge on compiler construction, but I think I can make a
good start. The implementation language I'll use will most probably be C.

The rest of parrot is in C, so that's a good choice, especially if you want
your code added to /languages in the parrot tree.

If he gets a Tcl compiler, I'll take it in any language he wants to write it in, up to and including Prolog. (Though I admit that, at some point, we should split the languages out of the base parrot tree. Not for a while though)

> Does anybody have a good suggestion or tips to help me get further? Or is
> anybody interested in this as well?

Get the Tcl source. Keep current with Parrot source
(http://dev.perl.org/cvs/) and of course being on this list is a good step.
You can probably start with Tcl's own lexer/parser and AST (assuming it
builds one), and traverse the AST to write out pasm/imcc code. I'm doing
some work with Ruby -> Parrot ("Cardinal"), or was until I got sidetracked
by the ops' destination values being unpredictable, and then sidetracked
again into working on a PHP to Perl translator.

Damn, we need to nail down which ops overwrite their destination and which ones store into their destination. I'll start getting that properly defined.

Parrot's a bit of a moving target, though, so be prepared to have to make
changes as the language/platform evolves.  You're fortunate in that Tcl's
fairly simple.

I should point out that it's not moving *that* much. The core op set hasn't changed in quite a while, though the newer ops do go through a round or two of fiddling before they settle down.


--
Will "Coke" Coleda

Reply via email to