Clifford Heath wrote:
> James Gray wrote:
>> On Feb 8, 2008, at 12:27 PM, Eric Mahurin wrote:
>>>> Treetop was definitely the most popular
>>> But not nearly the fastest...
>> That's true, but I think the need for raw speed in parsers is seldom
>> the top priority.
>
> I was frankly amazed how much of the discussion was about speed.
> Besides, there's an awful lot of useful languages that you can't
> do with LL(1). Including Ruby and C...
>
> That said, Treetop is very slow, and we need to improve that.
> Fortunately, it's not very hard to.
I was reading about PEG parsers on the wikipedia page [1], and wondered
along to a site about packrat parsers [2].
One article there [3] seems to imply that while a packrat parser's
memoization gives linear theoretical time, for almost all real grammars
(and inputs, I presume) it's actually not necessary.
They suggest that for the cases where there is a an exponential time
problem, it's sensible to rely on user supplied memoization directives
in the grammar, or to add memoization selectively and automatically,
based on profiling information.
I'm not sure if that's any help, or if you've already come across these
articles. Hopefully they're of some interest though.
Cheers,
Benjohn
[1]http://en.wikipedia.org/wiki/Parsing_expression_grammar
[2]http://pdos.csail.mit.edu/~baford/packrat/
[3]http://www.mercury.csse.unimelb.edu.au/information/papers/packrat.pdf
|