Re: Generating a simple hand-coded like recursive descent parser

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
11 Sep 2006 09:12:51 -0400

          From comp.compilers

Related articles
[7 earlier articles]
Re: Generating a simple hand-coded like recursive descent parser mr.waverlye@verizon.net (Mr.E) (2006-09-10)
Re: Generating a simple hand-coded like recursive descent parser mr.waverlye@verizon.net (Mr.E) (2006-09-10)
Re: Generating a simple hand-coded like recursive descent parser pjb@informatimago.com (Pascal Bourguignon) (2006-09-10)
Re: Generating a simple hand-coded like recursive descent parser tommy.thorn@gmail.com (Tommy Thorn) (2006-09-10)
Re: Generating a simple hand-coded like recursive descent parser ArarghMail609@Arargh.com (2006-09-11)
Re: Generating a simple hand-coded like recursive descent parser DrDiettrich1@aol.com (Hans-Peter Diettrich) (2006-09-11)
Re: Generating a simple hand-coded like recursive descent parser mailbox@dmitry-kazakov.de (Dmitry A. Kazakov) (2006-09-11)
Re: Generating a simple hand-coded like recursive descent parser mr.waverlye@verizon.net (Mr.E) (2006-09-11)
Re: Generating a simple hand-coded like recursive descent parser ArarghMail609@Arargh.com (2006-09-11)
Re: Generating a simple hand-coded like recursive descent parser mr.waverlye@verizon.net (Mr.E) (2006-09-11)
Re: Generating a simple hand-coded like recursive descent parser tommy.thorn@gmail.com (Tommy Thorn) (2006-09-12)
Re: Generating a simple hand-coded like recursive descent parser mr.waverlye@verizon.net (Mr.E) (2006-09-16)
Re: Generating a simple hand-coded like recursive descent parser tommy.thorn@gmail.com (Tommy Thorn) (2006-09-18)
[24 later articles]
| List of all articles for this month |
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Newsgroups: comp.compilers
Date: 11 Sep 2006 09:12:51 -0400
Organization: cbb software GmbH
References: 06-09-02906-09-035 06-09-039 06-09-042 06-09-043
Keywords: parse, Basic
Posted-Date: 11 Sep 2006 09:12:51 EDT

On 11 Sep 2006 08:39:39 -0400, ArarghMail609@Arargh.com wrote:


> On 10 Sep 2006 23:44:00 -0400, Tommy Thorn <tommy.thorn@gmail.com>
> wrote:
>
>>This exercise will likely teach you much that will be useful for a full
>>compiler for BASIC.
>
> It can be useful. As part of constant expression reduction, I had to
> scan the expression tree as if I were interpreting it. But that was
> added later.


Why? It is an integral part of the recursive descent parser. At some point
the parser expects an expression, so it calls to Get_Expression, which
scans up to the right bound of the expression (generating tree as a side
effect). Of course, it would be silly to design Get_Expression itself this
way, but that is no different from Get_Identifier or Get_Literal
subprograms. Expression is just a "token" for the parser.


--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


Post a followup to this message

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