Re: Is pyparsing really a recursive descent parser?

2007-11-08 Thread [EMAIL PROTECTED]
On Nov 3, 10:49 am, Paul McGuire [EMAIL PROTECTED] wrote: grammar ((word + grammar) | (word + Literal(end))) which works. [Clarifies that the common (and similar) solution doesn't work -- this works only because the literal binds tightly to the word, so you can't get a word that matches on

Re: Is pyparsing really a recursive descent parser?

2007-11-08 Thread [david]
Kay Schluehr wrote: Could you please learn some parser theory 101 and then come back when you have complaints about one or the other implemententation of a particular Python parser? When some guy enters a forum with a newbie question most of the time people are willing to give a fair and

Re: Is pyparsing really a recursive descent parser?

2007-11-08 Thread Kay Schluehr
On Nov 9, 12:28 am, [david] [EMAIL PROTECTED] wrote: Kay Schluehr wrote: Could you please learn some parser theory 101 and then come back when you have complaints about one or the other implemententation of a particular Python parser? When some guy enters a forum with a newbie question

Re: Is pyparsing really a recursive descent parser?

2007-11-07 Thread Just Another Victim of the Ambient Morality
Neil Cerutti [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 2007-11-05, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: Kay Schluehr [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I'm not sure one needs to start again with a naive approach just

Re: Is pyparsing really a recursive descent parser?

2007-11-07 Thread Just Another Victim of the Ambient Morality
Neil Cerutti [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 2007-11-07, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: Neil Cerutti [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] You might be interested in the Early parsing algorithm. It is

Re: Is pyparsing really a recursive descent parser?

2007-11-07 Thread Neil Cerutti
On 2007-11-07, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: Neil Cerutti [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] You might be interested in the Early parsing algorithm. It is more efficient than the naive approach used in your prototype, and still

Re: Is pyparsing really a recursive descent parser?

2007-11-07 Thread Chris Mellon
On Nov 7, 2007 3:15 PM, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: In short, it hasn't really evovled into a user-friendly package yet. Thank you. How is it that I seem to be the only one in the market for a correct parser? Earley has a runtine of O(n^3)

Re: Is pyparsing really a recursive descent parser?

2007-11-07 Thread Steven D'Aprano
On Wed, 07 Nov 2007 21:15:50 +, Just Another Victim of the Ambient Morality wrote: Why can't I find a pyparsing-esque library with this implementation? I'm tempted to roll my own except that it's a fairly complicated algorithm and I don't really understand how it's any more efficient than

Re: Is pyparsing really a recursive descent parser?

2007-11-07 Thread Just Another Victim of the Ambient Morality
Chris Mellon [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Nov 7, 2007 3:15 PM, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: In short, it hasn't really evovled into a user-friendly package yet. Thank you. How is it that I seem to be the

Re: Is pyparsing really a recursive descent parser?

2007-11-07 Thread Just Another Victim of the Ambient Morality
Steven D'Aprano [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Wed, 07 Nov 2007 21:15:50 +, Just Another Victim of the Ambient Morality wrote: Why can't I find a pyparsing-esque library with this implementation? I'm tempted to roll my own except that it's a fairly

Re: Is pyparsing really a recursive descent parser?

2007-11-07 Thread Chris Mellon
On Nov 7, 2007 5:15 PM, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: Chris Mellon [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Nov 7, 2007 3:15 PM, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: In short, it hasn't really

Re: Is pyparsing really a recursive descent parser?

2007-11-07 Thread Just Another Victim of the Ambient Morality
Chris Mellon [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Nov 7, 2007 5:15 PM, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: Chris Mellon [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Nov 7, 2007 3:15 PM, Just Another Victim of the

Re: Is pyparsing really a recursive descent parser?

2007-11-07 Thread Kay Schluehr
What do you mean by disambiguate? Do you mean disambiguate the grammar? One of the conditions of the problem is that you have no control over the grammar, so that's really not an option. Also, an implicit condition of solving a problem is that the problem be... solved, so not accepting

Re: Is pyparsing really a recursive descent parser?

2007-11-06 Thread Neil Cerutti
On 2007-11-05, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: Kay Schluehr [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I'm not sure one needs to start again with a naive approach just to avoid any parser theory. For a user of a parser it is quite important

Re: Is pyparsing really a recursive descent parser?

2007-11-06 Thread asdfjehqwjerhqjwljekrh
On Nov 2, 6:47 am, Paul McGuire [EMAIL PROTECTED] wrote: Well I'll be darned! All this time, I thought recursive descent described the recursive behavior of the parser, which pyparsing definitely has. I never knew that backing up in the face of parse mismatches was a required part of the

Re: Is pyparsing really a recursive descent parser?

2007-11-05 Thread Neil Cerutti
On 2007-11-05, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: Neil Cerutti [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] There are different kinds of recursion. Compare: While interesting, none of this actually addresses the point I was making. I

Re: Is pyparsing really a recursive descent parser?

2007-11-04 Thread Kay Schluehr
On 4 Nov., 03:07, Neil Cerutti [EMAIL PROTECTED] wrote: On 2007-11-04, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: Neil Cerutti [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 2007-11-03, Paul McGuire [EMAIL PROTECTED] wrote: On Nov 3, 12:33 am,

Re: Is pyparsing really a recursive descent parser?

2007-11-04 Thread Neil Cerutti
On 2007-11-04, Kay Schluehr [EMAIL PROTECTED] wrote: On 4 Nov., 03:07, Neil Cerutti [EMAIL PROTECTED] wrote: I wouldn't characterize it as pretending. How would you parse: hello end hello end WORD END WORD END and WORD WORD WORD END are both valid interpretations, according to the

Re: Is pyparsing really a recursive descent parser?

2007-11-04 Thread Just Another Victim of the Ambient Morality
Neil Cerutti [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 2007-11-04, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: Neil Cerutti [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Is there not an ambiguity in the grammar? In EBNF: goal --

Re: Is pyparsing really a recursive descent parser?

2007-11-04 Thread Neil Cerutti
On 2007-11-04, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: Consider writing a recursive decent parser by hand to parse the language '[ab]+b'. goal -- ab_list 'b' ab_list -- 'a' list_tail ab_list -- 'b' list_tail list_tail -- 'a' list_tail list_tail -- 'b'

Re: Is pyparsing really a recursive descent parser?

2007-11-04 Thread Just Another Victim of the Ambient Morality
Neil Cerutti [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 2007-11-04, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: Consider writing a recursive decent parser by hand to parse the language '[ab]+b'. goal -- ab_list 'b' ab_list -- 'a' list_tail

Re: Is pyparsing really a recursive descent parser?

2007-11-04 Thread Neil Cerutti
On 2007-11-04, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: Neil Cerutti [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I believe there's no cure for the confusion you're having except for implementing a parser for your proposed grammar. Alternatively, try

Re: Is pyparsing really a recursive descent parser?

2007-11-04 Thread Just Another Victim of the Ambient Morality
Neil Cerutti [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 2007-11-04, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: Neil Cerutti [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I believe there's no cure for the confusion you're having except

Re: Is pyparsing really a recursive descent parser?

2007-11-04 Thread Kay Schluehr
On Nov 4, 10:44 pm, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] I believe there is a cure and it's called recursive descent parsing. It's slow, obviously, but it's correct and, sometimes (arguably, often), that's more important the execution speed. Recursive decendent

Re: Is pyparsing really a recursive descent parser?

2007-11-04 Thread Just Another Victim of the Ambient Morality
Kay Schluehr [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Nov 4, 10:44 pm, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] I believe there is a cure and it's called recursive descent parsing. It's slow, obviously, but it's correct and, sometimes (arguably,

Re: Is pyparsing really a recursive descent parser?

2007-11-04 Thread Neil Cerutti
On 2007-11-05, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: Neil Cerutti [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 2007-11-04, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: Neil Cerutti [EMAIL PROTECTED] wrote in message

Re: Is pyparsing really a recursive descent parser?

2007-11-04 Thread Neil Cerutti
On 2007-11-05, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: Kay Schluehr [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Nov 4, 10:44 pm, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] I believe there is a cure and it's called recursive

Re: Is pyparsing really a recursive descent parser?

2007-11-04 Thread Neil Cerutti
On 2007-11-05, Neil Cerutti [EMAIL PROTECTED] wrote: def Ack(x, y): The Ackermann function. Creates a humongous mess even with quite tiny numbers. if x 0 or y 0: raise ValueError('non-negative integer') elif x == 0: return y + 1 elif y == 0:

Re: Is pyparsing really a recursive descent parser?

2007-11-04 Thread Just Another Victim of the Ambient Morality
Neil Cerutti [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 2007-11-05, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: Kay Schluehr [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Nov 4, 10:44 pm, Just Another Victim of the Ambient Morality

Re: Is pyparsing really a recursive descent parser?

2007-11-04 Thread Kay Schluehr
On Nov 5, 3:05 am, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: Kay Schluehr [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Nov 4, 10:44 pm, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] I believe there is a cure and it's called

Re: Is pyparsing really a recursive descent parser?

2007-11-03 Thread Kay Schluehr
On Nov 3, 6:33 am, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: Paul McGuire [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Nov 2, 5:47 am, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: Pyparsing is no recursive descent parser. It doesn't go

Re: Is pyparsing really a recursive descent parser?

2007-11-03 Thread Paul McGuire
On Nov 3, 12:33 am, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: It has recursion in it but that's not sufficient to call it a recursive descent parser any more than having a recursive implementation of the factorial function. The important part is what it recurses

Re: Is pyparsing really a recursive descent parser?

2007-11-03 Thread Neil Cerutti
On 2007-11-03, Paul McGuire [EMAIL PROTECTED] wrote: On Nov 3, 12:33 am, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: It has recursion in it but that's not sufficient to call it a recursive descent parser any more than having a recursive implementation of the

Re: Is pyparsing really a recursive descent parser?

2007-11-03 Thread Just Another Victim of the Ambient Morality
Paul McGuire [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Nov 3, 12:33 am, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: It has recursion in it but that's not sufficient to call it a recursive descent parser any more than having a recursive

Re: Is pyparsing really a recursive descent parser?

2007-11-03 Thread Just Another Victim of the Ambient Morality
Neil Cerutti [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 2007-11-03, Paul McGuire [EMAIL PROTECTED] wrote: On Nov 3, 12:33 am, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: It has recursion in it but that's not sufficient to call it a recursive

Re: Is pyparsing really a recursive descent parser?

2007-11-03 Thread Neil Cerutti
On 2007-11-04, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: Neil Cerutti [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 2007-11-03, Paul McGuire [EMAIL PROTECTED] wrote: On Nov 3, 12:33 am, Just Another Victim of the Ambient Morality [EMAIL PROTECTED]

Re: Is pyparsing really a recursive descent parser?

2007-11-02 Thread Paul McGuire
On Nov 2, 5:47 am, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: Pyparsing is no recursive descent parser. It doesn't go back in the input stream. The ``OneOrMore(Word(alphas))`` part eats the 'end' and when it can't get more, the parser moves to the ``Literal('end')`` part which fails

Re: Is pyparsing really a recursive descent parser?

2007-11-02 Thread Marc 'BlackJack' Rintsch
On Fri, 02 Nov 2007 06:05:13 +, Just Another Victim of the Ambient Morality wrote: 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

Re: Is pyparsing really a recursive descent parser?

2007-11-02 Thread Just Another Victim of the Ambient Morality
Paul McGuire [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Nov 2, 5:47 am, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: Pyparsing is no recursive descent parser. It doesn't go back in the input stream. The ``OneOrMore(Word(alphas))`` part eats the 'end' and when it

Is pyparsing really a recursive descent parser?

2007-11-01 Thread Just Another Victim of the Ambient Morality
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