[pypy-dev] Fwd: New Javascript parser in the works

Florian Schulze florian.schulze at gmx.net
Sat Apr 28 14:47:19 CEST 2007


On Sat, 28 Apr 2007 02:50:38 +0200, Leonardo Santagada  
<santagada at gmail.com> wrote:


>> Now about semicolons, how should I deal with them? in the spec the
>> grammar doesn't deal with them and in the mozilla one I don't see
>> how they are doing it also. As we have set that as the parsing
>> module works today it is not possible to do automatic semicolon
>> insertion, can we do "forced semicolon presence" as seen on C and
>> Java? (some lightbulb just lightened up here, maybe I should look
>> for the grammar of any of those two languages)

This is the biggest and hardest problem about js parsing. The spec does  
define how to handle it, I'm not sure now how the grammar reflects that  
though. Looking at C doesn't help, because there it always needs to be  
present and can't be replaced with newlines. The problem with a js parser  
is, that newlines aren't really whitespace, just like in python. But the  
rules are weird, because newlines are only sometimes relevant, not  
everytime. A js parser which doesn't handle this correctly is in my  
opinion just wrong. You couldn't parse any real world javascript with it.

Regards,
Florian Schulze




More information about the Pypy-dev mailing list