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

Laura Creighton lac at openend.se
Sat Apr 28 18:59:53 CEST 2007

In a message of Sat, 28 Apr 2007 18:22:50 +0200, Carl Friedrich Bolz writes:
>would be valid. This opens its own set of problems such as:
>     a = b
>     ++ c
>Which would most likely be parsed to be equivalent to:
>     a = b++;
>     c;
>Whereas with the spec it is:
>     a = b;
>     ++c;
>No clue how to fix that, yet.
>Carl Friedrich

In the Canadian military for an analagous set of problems we did the

First of all you do the laxness move -- i.e.  you get rid of the
semicolon restictions.  Then you get a big a sample space of the
problem you have as you are willing to deal with.  In some way
determine that it is 'typical' -- which is a research topic in itself,
but if you are not in the field, then the rule is 'make a good guess,
refine it later when you are wrong'.  Then determine where it is
better to stick in the semi based on how the language is actually
used.  So, should the spec differ from what you do, that is actually
of no problem until you find that people really write code like the
above and want the spec, not the way you parsed it.

You would be surprised at how many of those problems go away because
no human ever writes things like that.  Should your problem space
be dominated by machine-generated code, though, your personal
ideas of 'how often will somebody write this' goes out the window.

Laura, who thinks that the W3C validation project may be interested
in what you are doing and have already got some problematic use cases
to worry about.

More information about the Pypy-dev mailing list