Code checking with the Narcissus parser

G

glathoud

Hello, I ported the SpiderMonkey Narcissus parser to other
"Javascript" engines and wanted to share the resulting code [1]. As an
example, I wrote a code checker [2] that uses the parser.

Best regards,

Guillaume Lathoud

[1] cross-engine Narcissus parser for ECMAScript 3:
http://glathoud.easypagez.com/publications/jscheck/narcissus.jsdef.js
http://glathoud.easypagez.com/publications/jscheck/narcissus.parse.js
..
The parser works correctly on Firefox 3.6, Safari 4, Google Chrome 4
and the Google V8 Engine. Sadly, the parser breaks on Opera 10.10 -
help is appreciated.

[2] http://glathoud.easypagez.com/publications/jscheck/jscheck.xhtml
 
G

glathoud

How exactly does it break in Opera?

On parsing the original jsparse.js implementation. In more details:

* Open with Opera 10.10:
http://glathoud.easypagez.com/publications/jscheck/test-narcissus-xengine.html

* Open the Dragonfly developer tools.

* Click on the button "Start the test"

* You can then see the crash, somewhere deep in the parser:
| // Always use push to add operands to an expression, to update start
and end.
| Np.push = function (kid) {
| if (kid.start < this.start) // <<<< kid === undefined
| this.start = kid.start;

The `operands` array in the `Expression` seems to be somewhat
mismanaged under Opera. Curiously, there was no such problem in
Firefox 3.6, Safari 4, Google Chrome 4 and the Google V8 Engine (and
even Rhino).
Also, how ES3-compliant is your
port? Have you tried running it through, say, SputnikTests
(<http://code.google.com/p/sputniktests/>,
<http://kangax.github.com/sputniktests-webrunner/>)?

Thanks for the links. That would certainly be perfect to test the full
Narcissus implementation (parser + interpreter).
However, so far I only ported the parser. If you'd like to port the
interpreter as well, you are welcome!

In any case, I'll keep the Sputnik tests in mind.

Guillaume
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top