Re: Writing a recursive descent parser in C

spinoza1111@yahoo.com (Edward G. Nilges)
11 Dec 2001 21:33:45 -0500

          From comp.compilers

Related articles
Writing a recursive descent parser in C bilbo@volcanomail.com (2001-11-29)
Re: Writing a recursive descent parser in C spinoza1111@yahoo.com (2001-12-03)
Re: Writing a recursive descent parser in C joachim_d@gmx.de (Joachim Durchholz) (2001-12-07)
Re: Writing a recursive descent parser in C lingolanguage@hotmail.com (Bill Rayer) (2001-12-07)
Re: Writing a recursive descent parser in C dr_feriozi@prodigy.net (SLK Parsing) (2001-12-07)
Re: Writing a recursive descent parser in C alexc@world.std.com (2001-12-11)
Re: Writing a recursive descent parser in C spinoza1111@yahoo.com (2001-12-11)
| List of all articles for this month |
From: spinoza1111@yahoo.com (Edward G. Nilges)
Newsgroups: comp.compilers
Date: 11 Dec 2001 21:33:45 -0500
Organization: http://groups.google.com/
References: 01-11-146 01-12-008
Keywords: C, parse
Posted-Date: 11 Dec 2001 21:33:45 EST

spinoza1111@yahoo.com (Edward G. Nilges) wrote in message news:01-12-008...
> bilbo@volcanomail.com (Antoine Lec.) wrote...
>
> > Given a free-context grammar, I'm trying to write a recursive descent
> > parser for this grammar, with a minimum of function:
> >
> Here is the extempore C:
>
> isave = i;
> If ( checkTerminal(t, &i, end, "PRINT") ) {
> if ( checkTerminal(t, &i, end, identifier) )
> ||
> checkTerminal(t, &i, end, "*")
> && _
> checkTerminal(t, &I, end, identifier ) return(true);
> i = isave1; return(false);
> }


Brain fart: the above contains an error: it should be:


            isave = i;
            If ( checkTerminal(t, &i, end, "PRINT") ) {
                  if ( checkTerminal(t, &i, end, identifier)
                            ||
                            checkTerminal(t, &i, end, "*")
                            && _
                            checkTerminal(t, &I, end, identifier) ) return(true);
                  i = isave1; return(false);
                  }


The parentheses were misplaced in the extempore code.


Post a followup to this message

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