Homemade Compilers?

andy@ice.stx.com (Andy Moore)
Tue, 15 Sep 1992 17:25:04 GMT

          From comp.compilers

Related articles
Homemade Compilers? andy@ice.stx.com (1992-09-15)
| List of all articles for this month |

Newsgroups: comp.sys.cbm,comp.compilers
From: andy@ice.stx.com (Andy Moore)
Organization: Hughes STX, Lanham, MD
Date: Tue, 15 Sep 1992 17:25:04 GMT
Followup-To: comp.sys.cbm
Keywords: design, question, comment

Howdy! I'm considering trying to write my own compiler for my C-64.

Yes, you read that right. I'm fool enough to try it. I'm a professional
software engineer. My education and experience is more with applications
than systems, but I've written more than a few successful translators,
converters, parsers, etc, all on my own without training. I've also done
some 6502 assembly language, so I'm at least somewhat familiar with the
target machine.

What I'm looking for is advice, lessons learned, suggestions, pitfalls,
etc. from anyone who has tried anything like this before. If people have
tried this and failed, I'd like to know where you got tripped up.

I've got a list of good books on compiler theory and design (from
comp.compilers FAQ, thanks), although I'm inclined to try an intuitive
approach. I don't *have* to do this, and it's sort of for fun and
enlightenment. So trial and error is acceptable, within limits...

My preliminary strategy is to define a very simple, minimal language, sort
of a subset of Pascal or C, perhaps only one data type (byte). Then I'd
blunder through the design of some sort of parser/code-generator
combination, and implement it with the built-in interpreted BASIC, then
use that to compile another implementation written in the language itself,
thereby bootstrapping myself up to a minimal but functional compiler.
Sound reasonable?

I should mention that my goals and purposes for a compiled language are
reasonably fast I/O and device control (in my specific case, MIDI (music)
applications). I don't think I'd need a full general-purpose language,
more like a PL/M or simple C (although I'd prefer a Pascal-like syntax).

Thanks in advance for any and all advice. E-mail and I'll summarize to
the net. And if I manage to come up with something workable, I'd be happy
to share it with anyone who's interested, too. Wish me luck!
Andy Moore
[Good luck -- the 6502 is a hard machine to compile for, due to limited
memory and strange stack support. -John]

Post a followup to this message

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