Version 15 of RAPL

Updated 2012-01-15 13:19:55 by apw

RAPL is an acronym for Rapid Application Programming Language.

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. 55 of the 87 itclinjavascript tests now running as expected. Code is now about 23.500 LOC in Javascript.

Stay tuned!