parrotcode: Untitled | |
Contents | Language Implementations | TCL |
This is a from-scratch implementation, based primarily on the tcl man page(s), and the cvs-current test suite for tcl (8.5)
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 be a big deal.)
When you make tcl, you're generating several files:
compile
opcode.tclsh
- It takes the command line arguments (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.
You can also specify command line options to be used with this bytecode file.PIR
files are generated from their corresponding .tg
and .pg
files.
These grammar files allow us to use PGE's implementation of perl6 rules to more simply specify our parsing rules.
We use these rules to handle both the general parsing for tcl itself,
as well as the sub-"language" used by expressions in [expr] and elsewhere.The Tcl PMCs (Parrot Magic Cookies) are the user visible data types.
These live in the *.pmc
files in src/pmc/.
They are compiled into a dynamically loadable library which is loaded with the .HLL
directive (HLL stands for High Level Language).
Most of the functionality associated with these PMCS is derived from the base parrot classes,
except as noted below.
.0
.[list]
builtin.
Overrides the default stringification provided by parrot Arrays.[array]
builtin.[dict]
builtin.
Unlike arrays,
dictionaries can nest,
having dictionaries as values; Also,
dictionaries act more like TclLists in terms of their conversion to string and back.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.
Occasional failures are suspected against svn-head; there should be no failures in a released version,
however.
To run the tcl test suite,
type make tcl-test
.
This will checkout the latest cvs copy of the tests from the tcl repository and run them.
Warning,
this can be a little slow.
There are examples in the examples
directory that are vaguely more interesting.
Change to that directory and type make
for directions.
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"
partcl has gone through many iterations since its original beginnings, requiring many updates as various parts of parrot have changed, and as we implement features which require extensions to our framework.
|