Re: Parsing newbie -- recursion question (probably simple)

Des Watson <desw@sussex.ac.uk>
13 Nov 2005 22:05:02 -0500

          From comp.compilers

Related articles
Parsing newbie -- recursion question (probably simple) sonicsmooth@gmail.com (2005-11-12)
Re: Parsing newbie -- recursion question (probably simple) wyrmwif@tsoft.org (SM Ryan) (2005-11-13)
Re: Parsing newbie -- recursion question (probably simple) DrDiettrich@compuserve.de (Hans-Peter Diettrich) (2005-11-13)
Re: Parsing newbie -- recursion question (probably simple) desw@sussex.ac.uk (Des Watson) (2005-11-13)
Re: Parsing newbie -- recursion question (probably simple) 63q2o4i02@sneakemail.com (2005-11-15)
Re: Parsing newbie -- recursion question (probably simple) cfc@shell01.TheWorld.com (Chris F Clark) (2005-11-15)
Re: Parsing newbie -- recursion question (probably simple) nicola.musatti@gmail.com (Nicola Musatti) (2005-11-15)
| List of all articles for this month |

From: Des Watson <desw@sussex.ac.uk>
Newsgroups: comp.compilers
Date: 13 Nov 2005 22:05:02 -0500
Organization: Compilers Central
References: 05-11-059
Keywords: parse

sonicsmooth@gmail.com wrote:


> I'm having trouble getting my head wrapped around recursion. If I have
> the following rule to generate a list of nodes:
>
> nodelist := nodelist node | node


Left recursion! Not good for a traditional top-down parser, I'm afraid.
    It's probably easiest here to think about rewriting this production:


nodelist := node {node}


defining a nodelist as a node followed by an arbitrary number of nodes.
    Then writing a top-down recogniser for this is much easier...


Des Watson


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.