On Aug 29, 2011, at 7:55 PM, xiaoming gu wrote: > Hi, all. I'm Xiaoming Gu and a new guy studying SquirrelFish. I got to know > that there are three compilation steps > from JS source code to machine code: JS source code to AST tree by the > parser, AST tree to byte code by the > byte code generator, and byte code to machine code by the JIT compiler. > > Now I'm getting to know the parser. Following are two questions. > 1. Is the parser based on an LL(1) grammar? No. The ECMAScript grammar can be found in the ecma-262 specification, Annex A contains a summary of the grammar.
The spec provides what is essentially an LALR grammar with additions for optional terms and lookahead restrictions. That said, JSC uses a hand written, mostly LL(1) parser with occasional excursions into larger lookaheads. > 2. Where are the grammar rules? The annex in ECMAScript Language > Specification? Annex A of ECMA-262 contains a summary of the grammar with references to the various sections defining the behaviour of each production. Hope this helps, --Oliver > > Thanks. > > Xiaoming > _______________________________________________ > squirrelfish-dev mailing list > [email protected] > http://lists.webkit.org/mailman/listinfo.cgi/squirrelfish-dev
_______________________________________________ squirrelfish-dev mailing list [email protected] http://lists.webkit.org/mailman/listinfo.cgi/squirrelfish-dev
