Is pyparsing really a recursive descent parser?

Just Another Victim of the Ambient Morality ihatespam at hotmail.com
Fri Nov 2 07:05:13 CET 2007


    Is pyparsing really a recursive descent parser?  I ask this because 
there are grammars it can't parse that my recursive descent parser would 
parse, should I have written one.  For instance:


from pyparsing import *

grammar = OneOrMore(Word(alphas)) + Literal('end')
grammar.parseString('First Second Third end')


    Amazingly enough, this will fail to parse!
    Now, maybe I have no idea what I'm talking about but shouldn't a 
recursive descent parser recursively descend through all possible rule 
combinations to discover one that works?  Why does pyparsing fail to parse 
this?  Is there a way to get pyparsing to parse a grammar like this?
    Thank you... 





More information about the Python-list mailing list