[Webkit-unassigned] [Bug 34019] Custom-written JavaScript parser

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jan 26 14:35:53 PST 2010


https://bugs.webkit.org/show_bug.cgi?id=34019


Oliver Hunt <oliver at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #47407|review?                     |review-
               Flag|                            |




--- Comment #18 from Oliver Hunt <oliver at apple.com>  2010-01-26 14:35:51 PST ---
(From update of attachment 47407)
I don't think there's any reason to still use cumulative "feature" flags.

What you should do is have a function stack (very much pseudo code):
struct FunctionInformation {
    Features features;
    Vector<VariableDeclaration> variables;
    ... etc ...
}
Vector<FunctionInformation> functions;

Then when the parser starts a new function it should simply do:
functions.append(FunctionInformation);

And all the various constructs that add features become:
functions.last().features |= NewFeatures;

case VarDeclaration:
    ...
    functions.last().variables.add(theNewVariableDeclaration);
    ...

etc

(so we lose all the various array and feature unification rules)

The only reason we use cumulative feature flags currently is because yacc/bison
generate bottom up parsers which by definition can't do this (the parser
doesn't "know" it's producing a function until it has already parsed the child
statemetns)

In terms of style rather than the current top(-n) = new Node(top(), top(-1),
..., top(-n)) i would prefer
push(new Node(pop(), pop(), ...)

Which i think is much nicer.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list