[webkit-reviews] review denied: [Bug 34019] Custom-written JavaScript parser : [Attachment 47407] Selectable JavaScript grammar (+mac build support)
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Jan 26 14:35:51 PST 2010
Oliver Hunt <oliver at apple.com> has denied Zoltan Herczeg
<zherczeg at webkit.org>'s request for review:
Bug 34019: Custom-written JavaScript parser
https://bugs.webkit.org/show_bug.cgi?id=34019
Attachment 47407: Selectable JavaScript grammar (+mac build support)
https://bugs.webkit.org/attachment.cgi?id=47407&action=review
------- Additional Comments from Oliver Hunt <oliver at apple.com>
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.
More information about the webkit-reviews
mailing list