APWTCL

APWTL is the renamed RAPL page.

APWTCL is an acronym Arnulf's Preferred Web TCL

Right now it is Tcl Parser in Javascript (similar to the parser in incr Tcl in Javascript), which produces a binary struct like meta representation of the parsed input. Maybe in the future there will be some extensions to standard Tcl. It will not support all of Tcl, it will support that part of Tcl, which can be run in a browser environment.

 History of the development steps

The meta information is built using ArrayBuffer and DataView (typed arrays)

It is a work in progress started at November 2011 by apw.

The idea is to have some code (in whatever language C/Javascript/others) which can do optimisation on that meta representation and then have a backend (again in whatever language C/Javascript/others) to interpret the meta information.

The first first version will be: also the backend (interpreter) will be in Javascript and it is planned to use that eventually as a general possibility to run RAPL/Tcl input in a browser and on smart phones.

apw 2011-11-20: the results of the experiments with the meta information were not as interesting as I thought, so I am now experimenting with reimplementing a part of Jim in Javascript. Parsing and storing of token list in script tokens is working mostly. Now experimenting with either using execution part of incr Tcl in Javascript or use more code from Jim.

The meta information part is still available/usable in parallel for eventual later experiments. The parser part can either be used for producing meta information or for producing Tcl_Obj information like in Jim.

apw 2011-12-04: first statements are running. Use of Tcl_Obj is done as in Jim (the equivalent of Tcl_Obj there is Jim_Obj). Be aware, that Jim_Obj is not identical to Tcl_Obj (see Jim documentation for that).

There are a lot more obj types in Jim like sourceObjType, scriptObjType and scriptLineObjType and a lot of others, which I find very useful.

For locating and administrating variables I will use mostly the parts from incr Tcl in Javascript namely callframes (a little bit different to Jim_CallFrame) and namepaces, as that provides more stuff needed for itcl/snit functionality in itcl as in itcl-ng than the namespace implementation of Jim.

So parsing, tokenizing, use and handling of Tcl_Obj's and "objectifying" is mostly done as in Jim. Also a lot of the Tcl_Obj Evaluation is identical to Jim.

apw 2011-12-10: did some simple performance analysis: setting a variable and setting a variable with the value of another variable. Looks not so bad. RAPL compared to Tcl 8.6 head using js shell from mozilla spidermonkey for RAPL is "only" about 25-30 times slower, which seems to be an advantage compared to JimTcl against JimTcl compiled to Javascript using emscripten done by Steve Landers, which showed a factor of 50-80 times slower for the latter. I hope that this comparison is generally OK.

apw 2011-12-20: a big part of namespace and namespace command implementation (including namespace ensembles) as well as a big part of list command and dict command implementation is done and working. Also a lot of expr command implementation is done and working. CallFrames are now implemented very similar to Tcl implementation. Variable access for variables, dicts and arrays is mostly done and working. Array variables are implemented (as in Jim) as dicts under the hood. About 80% of the code in Javascript is now implemented as in Jim. The rest is either implemented as in Tcl or code better suitable for Javascript than the equivalent C code (for example hash tables are directly available as associative arrays).

RAPL compared to Tcl 8.6 head using js shell from mozilla spidermonkey for RAPL is "only" about 15-25 times slower in the meantime (some better performance with modified callframe handling).

apw 2012-01-06: namespace variables now working. Fixes for callframes and dicts done. About 30 of the 87 itclinjavascript tests now running as expected, so there is some progress. Code is now about 20.000 LOC in Javascript.

apw 2012-01-15: first part of itcl parser is implemented. Some new commands and a lot of fixes especially for callframes and procedure call handling. 77 of the 87 itclinjavascript tests now running as expected. Code is now about 24.000 LOC in Javascript.

apw 2012-01-22: itcl class creation, itcl class object creation and calling itcl class object constructor as well as calling a class method from the class object is now working. 85 of the 87 itclinjavascript tests now running as expected. Code is now about 26.000 LOC in Javascript.

apw 2012-01-29: calling itcl methods in a superclass as well as access to variables in classes and superclasses and the builtin cget method is now implemented and working. Command and variable resolution for itcl is now mostly done and working (access checking still needed). Setting and getting options in extendedclass is done and working. Next parts to implement: configure, validate, delegate and component. Also the Tk parts done for incr Tcl in Javascript have to be reimplemented using RaplObjects. Maybe I will try to (re)implement some of the base parts done for ntkWidget with HTML5 canvas.

apw 2012-02-08: ::itcl::type and ::itcl::macro are now implemented and for simple cases running. The first delegated method and install command for ::itcl::type constructor are working. Implementation for handling/use of a component for delegation is done. Have now 114 tests. Code is now about 29.000 LOC in Javascript.

apw 2012-02-12: some more Tcl commands implemented, cget and configure implementation for different itcl class types is mostly done including handling of delegated options. Additionally a lot of bug fixes found with testing have been done. Code is now about 30.000 LOC in Javascript.

apw 2012-02-19: have made a lot of progress. Bigger parts of itcl are now running correctly. As an example I have used wtk from Mark Roseman. The widgets are written with snit which is mapped to itcl functionality using an interp alias. And the communication is done using direct function calls implemented as a wrapper in RAPL. These are the only modifications to wtk.js original file. The test suite for wtk is running with no modification successfully. A little demo can be found here: rapl wtk button demo. The wtk test suite example demo can be found here: wtk tests.

Stay tuned!

steveb 2012-02-22: Tried your demo in Safari. Got a few javascript errors as follows:

rapl_variable_obj_type.js:638   SyntaxError: Expected an identifier but found '.' instead
rapl_pkg_tracecmd.js:42   SyntaxError: Expected an identifier but found '.' instead
rapl_interp.js:65   TypeError: 'undefined' is not a constructor (evaluating 'new R.VariableObjType(intp)')

apw 2012-02-22: Sorry forgot to mention: I have only tested with firefox 10.0.1. Will try to fix the problems asap.

MartinCleaver 2012-06-28 Any further on this? Thanks, M.

apw 2012-06-29: If you mean the Safari Problem, I did not yet spend time to figure out. If you mean APWTCL itself, there is similar work in progress: APWTCL (Java) and APWTCL (Objective C).