Re: [Pyparsing] parsing an operator-precedence-based grammar with reasonable performance?
Brought to you by:
ptmcg
From: Gre7g L. <haf...@ya...> - 2008-07-06 16:32:09
|
You'll need to enable Packrat. It makes a huge difference, especially with operatorPrecedence. Gre7g ----- Original Message ---- From: Andrew Warkentin <and...@gm...> To: pyp...@li... Sent: Friday, July 4, 2008 9:43:10 PM Subject: [Pyparsing] parsing an operator-precedence-based grammar with reasonable performance? I am trying to write a parser for a regexp-like matching language using pyparsing. It can be implemented in terms of operator precedence. I tried using the operatorPrecedence function, but the performance is unacceptable for expressions containing nested parentheses. Parsing time appears to increase exponentially with the number of nested parentheses, and the parsing time for each set of nested parentheses appears to increase exponentially with the number of operators in the grammar. Even parsing something as simple as "(foo(bar))" with a grammar of 4 binary and 2 unary operators takes ridiculously long (about 2 minutes). Is there any way to parse operator-precedence-based grammars using pypasing that doesn't increase exponentially in run time with the number of nested parentheses? ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Pyparsing-users mailing list Pyp...@li... https://lists.sourceforge.net/lists/listinfo/pyparsing-users |