On 27.02.2012 20:36, Hisayuki Mima wrote:
(2012/02/27 19:42), Dmitry Olshansky wrote:
On 26.02.2012 15:07, kenji hara wrote:
Hisayuki Mima's ctpg is compile-time parser generater, and the
generated parser works in compile time!
https://github.com/youkei/ctpg

Kenji Hara


Nice! I'm curious as to which parsing method the generated parser does
employ (it isn't immediately obvious ;) ).
Examples look good, but I don't seem to get how recursive sample
fails match(?) e.g. "aaaaa" given the grammar:
recursive -> A $
A -> a A a | a

I mean it's any odd-length sequence of a.


Parsing method which the generated parser employs is Recursive Descent
Parsing.

OK, does it check for Left recursive grammars?

And the behavior of the parsers recursive and A is a little bit
complicated.
The parser recursive matches the sequence of 'a' whose length is 2^n-1
such as 1, 3, 7 and 15.

Well I'm missing something about that BNF-grammar(right?) but undoubtedly:
recursive -> A $ -> a A a $ -> a a A a a $ - > a a a a a $
As for task of parsing only 2^n-1 sequences of "a" by CFG that's news for me.

Anyway, I'm going to write more documentation of ctpg within a few days.
I hope it'll help you.


Please do, the project with such potential should not stay undocumented.

--
Dmitry Olshansky

Reply via email to