On 10/15/2005 at 5:55 PM Jules Richardson wrote:
I missed the OP doing that - what was the reason?
Pretty much any
language is going to be natively compiled in this scenario surely?
Java's one of the few where there's the option to run interpreted code
(which might be useful in this situation)
A slightly OT subthread.
Back when I was just out of school, I was assigned to a COBOL translator
project with a fellow who was part of the IBM COMTRAN project and who had
written COBOL compilers to run on some of the strangest hardware you could
imagine (e.g., a CDC 6600 PPU with lots and lots of overlays). (He left IBM
when they assigned him to the PL/I project).
He claimed ignorance of the host architecture of any of the systems he'd
worked on (though, I suspect he was pulling my leg).
His approach was quite unconventional for that day. Basically, he defined
two machines--a compile machine and an execution machine. The compile
machine would typically have an instruction set that handled things like
tokens and numbers and output things like execute machine instructions. A
typical instruction might be:
IQTF TCOMMA,sub1,label2
meaning examine the next input token; if it's a comma, call sub1, otherwise
jump to label2. He'd then have some junior programmer (me, for instance)
write an interpreter for the instruction set, as well as the macro
definitions that encoded his pseudo instructions.
The execution machine was done similarly, but obviously with a different
instruction set. This enabled him to get a very compact compiler and
run-time up and running very quickly, since he'd already done much of the
work for other projects he'd worked on.
Eventually, when everything was shaken out, we'd exchange the interpreter
for inline macro definitions on the compiler end and had the execution code
generator spit out real assembly code.
I subsequently used this approach for a couple of microcomputer BASIC
compilers with great success. I believe that Ryan-McFarland did something
akin to this also for their products, so it wasn't a carefully-held secret.
As for my compiler guy, one interesting aspect of his life was that he
lived much of the time with a band of gypsies in the Santa Cruz mountains
and came down to the valley when he ran out of money...
Cheers,
Chuck