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
Return to the
comp.compilers page.
Search the
comp.compilers archives again.