[Webkit-unassigned] [Bug 33860] potential speed up of parser by recoding expression rules

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jan 19 13:09:33 PST 2010


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





--- Comment #1 from Patrick Mueller <pmuellr at yahoo.com>  2010-01-19 13:09:34 PST ---
In case the link in the summary goes away, here is the relevant text:

    One more hint:

    If the language has compicated expression syntax (like C)
    it is more efficient to express operators precedence explicitly
    by %prec directiove, instead of expression syntax tricks like
    it is done in the ISO C and C++ Draft Standatd (where operators
    precedence is expressed implicitly).

    It is significanly reduces number of reduces (by mean of LALR
    algorithm) while parsing.

    For example:
    [bad style]
    AdditiveExpression:
    AdditiveExpression AddOperator MultiplicativeExpression |
    MultiplicativeExpression;

    AddOperator:
    lxmPlus |
    lxmMinus;

    MultiplicativeExpression:
    MultiplicativeExpression MulOperator HighPrecExpression |
    HighPrecExpression;

    MulOperator:
    lxmMul |
    lxmDiv;

    [better style]
    Expression:
    HighPrecExpression |
    lxmLeftPar Expression lxmRightPar |
    Expression lxmPlus Expression    %prec pseudoAdditive |
    Expression lxmMinus Expression    %prec pseudoAdditive |
    Expression lxmMul Expression    %prec pseudoMultiplicative |
    Expression lxmDiv Expression    %prec pseudoMultiplicative;

    Regards,
    Alexander.
    --
    Alexander N. Krotoff     krotoff at such.srcc.msu.su
    Research Computer Center    tel: +7(095)939-2638
    Moscow State University     fax: +7(095)939-4430

-- 
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