Compiler with easily retargetable and flexible back-end?

I'm currently taking a computer engineering course that involves a gratuitous amount of assembly programming. Sadly, it's largely superfluous to the actual course work (implementing processor componentns), so I'd like to program in a high level language.

I've looked at several compilers (gcc, mit-scheme, and ocaml) so far and all of them seemed to require a fair amount of work to retarget. Moreover, the processor we are implementing doesn't use a totally conventional execution model due to time constraints on the class. It essentially omits registers and works directly in memory.

I'll also admit my knowledge on compilation is lacking; it's taking me time to get through the dragon book1. I had no problem following along with Crenshaw's "Let's Build a Compiler!" on my architecture, and Ghuloum's "An Incremental Approach to Compiler Construction" also seemed doable, although I have not gone through it in any detail.

With that in mind, are there any compilers that would be easy (or at the very least, not excessively painful) to retarget to such an architecture? I'd assume that a lisp will probably occupy this niche, but I'm comfortable with any language.

1 I've heard that Wirth's compiler book is more approchable; is this true?

Edit: Added links.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

LCC?

I haven't personally used it, but LCC was designed to be retargetable and it has it's own book. It was even used to generate bytecode for the Quake series of games.

http://www.cs.princeton.edu/software/lcc/

Forth

If you just want a simple language that lets you work at a higher level than assembler, Forth seems perfectly suited. A subroutine threaded implementation can just barely be called a compiler, and the runtime environment is very light (two stacks), so you can easily mix forth and assembler. A Lisp interpreter would probably not be too hard to do (especially in Forth), but a Lisp *compiler* is definitely a decent amount of work, especially considering it's not your end goal. In either case, if you go with Lisp, you'll probably have to write a GC, which doesn't sound like a fun thing to do in assembler.