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 |
Posted-Date: | 11 Sep 2006 08:39:39 EDT |
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
Return to the
comp.compilers page.
Search the
comp.compilers archives again.