OVERVIEW ^

This was originally written as a perl5 script. Rather than doing bootstrapping, I foolishly decided it would be fun to write the parser IN parrot assembly, esp. as this would help implementing "eval" and "proc" (Of course, in retrospect, I really wish I had kept with the bootstrapping effort, as I think it would have generated usable results sooner. Ah well, I now know more than I want to about IMCC. =-)

This is a from-scratch implementation, based only on the tcl man page(s). Another interesting project would have been to modify the tcl source and have it generate parrot directly. Many people smarter than I am have declared this hard, so I'm rather happy I'm working on it this way.

(Apparently Tcl's bytecode engine is very optimized for Tcl (big surprise). So, converting the tcl-specific bytecodes there to parrot would apparently be a big deal.)

RUNNING TCL ^

When you make tcl, you're generating three files.

lib/tclword.pbc

This is a parrot class that is used by the parser as the intermediate representation after parsing. So, for example, a line like

 set a "$b " 
would, after parsing, be comprised of three tclwords. The first, the constant set, the second, the constant a, and the third would consist of two elements: the variable reference for b, followed by the constant .

lib/tcllib.pbc

This .imc file is used to load all the various commands, ops, etc. into the appropriate namespaces, as well as declare and register the TCL compiler for the compile opcode.

tcl.pbc

This is roughly equivalent to tclsh - It takes the command line argument (currently, the name of the file you wish to parse), and reads in the file, and uses the tcl library to parse those contents as tcl.

TESTS ^

To run the test suite, make test. If you want to also get output from the TODO tests, make devtest instead. This is NOT the tcl test suite, it's a very small subset of features that I was sick of fixing everytime I made a small change to the parser.

EXAMPLES ^

There are examples in the examples directory that are vaguely more interesting. To run one of the foo.tcl files in that directory, type make foo.

POD ERRORS ^

Hey! The above document had some coding errors, which are explained below:

Around line 49:

=back doesn't take any parameters, but you said =back 4


parrot