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

Leonardo Santagada santagada at gmail.com
Sat Apr 28 02:50:38 CEST 2007


Forgot to send to pypy-dev. And now I commited code that was supposed  
to do what I wanted with the tests in revision 42384. But the code is  
ugly, my visitor somehow don't visit everyone it should and I am to  
sleepy to code. Am I doing things the wrong way or doing what I  
wanted with the tests that hard?

Iniciar mensagem reenviada:

> De: Leonardo Santagada <santagada at gmail.com>
> Data: 27 de abril de 2007 19h24min15s GMT-03:00
> Para: Carl Friedrich Bolz <cfbolz at gmx.de>
> Assunto: Re: [pypy-dev] New Javascript parser in the works
>
>
> Em 27/04/2007, às 17:11, Carl Friedrich Bolz escreveu:
>
>> Carl Friedrich Bolz wrote:
>>> Just looking at the grammar made me note the following problem:
>> [snip]
>>
>> hm, now that I found this problem, which grammar are you using  
>> exactly? The one at
>>
> the one in the standard, as you sugestd to me... it is at:
> http://www.ecma-international.org/publications/standards/Ecma-262.htm
>
>> http://www.mozilla.org/js/language/js20/formal/parser-grammar.html
>>
>> gives the rules for addition correctly:
>>
>> AdditiveExpression ==>
>>    MultiplicativeExpression
>> |  AdditiveExpression + MultiplicativeExpression
>> |  AdditiveExpression - MultiplicativeExpression
>>
>> or did you just rewrite it incorrectly?
>>
>
> I both rewritten it incorrectly and also there is a problem, if I  
> put MultiplicativeExpression first like on the standard and in the  
> mozilla one I get code like 5+4 interpreted as having one  
> multiplicative expression with 5 and somehow it doesn't consume all  
> the input and still thinks it is valid.
>
> The other problem was that I didn't know how to fix it, so I just  
> did what I could expecting that with some code people would help me  
> more (this one I got right :). The biggest problem with parsing is  
> that there is no one using it besides you... at least you help me a  
> lot so i'm not really complaning.
>
> About tests I'm having this problem, I want to create generator  
> tests like some that I have but I would like to do something like  
> having lots of lines of tests, maybe with comments and maybe  
> setting what would be the start simbol to try to match it. Also I  
> would like to be able compare the results doing tests like:  
> checking the number of a type of node on the tree (eg: 5+5 should  
> have 2 numeric literals). The perfect thing would be able to print  
> how the trace of the packratparser, seeing what rules it is  
> executing. But I really want to have a better testing suite, but  
> like just failing some test for a reason I do not know or passing a  
> test but doing things completely wrong is not sufficient for me  
> now... I will work to make this test tool.
>
> 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)
>
>
>
>> Cheers,
>>
>> Carl Friedrich
>
> --
> Leonardo Santagada
> santagada at gmail.com
>
>
>

--
Leonardo Santagada
santagada at gmail.com






More information about the Pypy-dev mailing list