Saturday, May 17, 2008

JavaScript with YACC and LEX

Pressing on with Cello I have started compiling the files that are responsible for the implementation of ECMA script (JavaScript).

Inheriting a code base is a whole set of surprises one of which is that Cello has its own JavaScript interpreter built in. I have some experience of working with SpiderMonkey and have looked at the JavaScript interpreter that is built into WebKit. Implementing a JavaScript interpreter is not a small job - and as with most of the Cello code it is well written and easy to understand. Down the line when everything is working (quite a distant point) I may remove it and instead use the WebKit implementation of JavaScript - I don't have any immediate desire to do this - instead I am very much following the path of least resistance.

At the moment the easiest route is to get it to compile and build. Thus far, working through the code file by file, the code compiles with few errors - typically four or five per file and I have so many clean runs (files with no errors) that I look forward to the ones with problems to fix. The biggest issues I have had (so far) is the absence of _fpclass, but the equivalent fpclassify seems to fit the bill.

For fun and games down the line Cello links against Bumble-Bee Software's Pargen YACC and Lex libraries. The source of these libraries is available (though not included in my Cello sources). Building these seems quite possible.

No comments: