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

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

          From comp.compilers

Related articles
[5 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 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)
[30 later articles]
| List of all articles for this month |

From: ArarghMail609@Arargh.com
Newsgroups: comp.compilers
Date: 11 Sep 2006 08:39:39 -0400
Organization: Ripco Communications Inc.
References: 06-09-02906-09-035 06-09-039 06-09-042
Keywords: parse

On 10 Sep 2006 23:44:00 -0400, Tommy Thorn <tommy.thorn@gmail.com>
wrote:


>Mr.E wrote:
>> From what I've read, many compilers are grown and extended by using
>> their own language, I like that idea.
>
>Using the right language will teach you concepts that makes doing this
>so much easier. At the very minimum you need product (~ "struct") and
>sum (~ "union") types. In (classic) BASIC you'd have to simulate those
>making it a very unnatural and messy implementation.


You don't really need a "union" type. It would just make some things
a little easier. I didn't need one for BCET.


<snip>


>If you manage this in BASIC, then next make a compiler for it.


I did. BCET is written mostly in Basic. Some routines are written in
Assembler, mostly for speed(they were originally developed in Basic).


>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. The original compiler would actually generate
instructions to add 1 and 1 for a statement like:
LET A = 1 + 1


<snip>
--
ArarghMail609 at [drop the 'http://www.' from ->] http://www.arargh.com
BCET Basic Compiler Page: http://www.arargh.com/basic/index.html


Post a followup to this message

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