|Contents | Language Implementations | TCL|
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.)
When you make tcl, you're generating three files.
set a "$b "
set, the second, the constant
a, and the third would consist of two elements: the variable reference for
b, followed by the constant
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.
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.
There are examples in the
examples directory that are vaguely more interesting. To run one of the
foo.tcl files in that directory, type
Hey! The above document had some coding errors, which are explained below: