On Jun 8, 2007, at 7:36 AM, Roman Redziejowski wrote:

On May 20 15:02:40 EDT 2007 Terrence Parr wrote:

"I typed in a Java grammar from spec, cleaning up issues.  It never
terminates on some JDK 1.4 input files w/o memoization."

Hi Roman,

Interesting thoughts...thanks.

My parser was pretty fast with memoization ;) No attempt at optimization.

A recursive-descent parser obtained by transcribing this PEG into executable code accepts, without memoization, all source files from J2SE 5.0 JDK, and a number of files from other projects, alltogether almost 12000 files. Of course, the performance is not brilliant, but what one can expect if you need a whole pile of procedure calls to get to a single letter of an identifier at the bottom of an expression, and a lot of calls and backtracking to distinguish an identifier from a keyword. However, the parsing time, measured in number of procedure calls, is linear in the file size across the whole sample.

Despite the disadvantages, I still favor the separate lexer as it's faster.

Ter

_______________________________________________
PEG mailing list
PEG@lists.csail.mit.edu
https://lists.csail.mit.edu/mailman/listinfo/peg

Reply via email to