[antlr-interest] philosophy about translation

Oliver Wong owong at benchmarkconsulting.com
Thu Nov 2 07:24:13 PST 2006



-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Anthony W.
Youngman

>>> A C compiler can compile itself. Can a Java system build itself?
>>> How much of Java is actually written in Java? (Oh and I'm
>>> including the supporting libraries here!)
>>
>>Almost all of Java is written in Java. The only part that's not
>>is the lowest layer, which is OS and hardware specific.
>>
> Assembler is written in assembler, pretty much without exception.
> C is written in C, pretty much without exception.

	I think you (plural) might be conflating a language with an
implementation of the toolset for that language. Java, C and assembler
are languages, and you can't "write" (in the sense of program) a
language. You could program a compiler or an interpreter for these
languages. But you can't "write" the languages themselves.

	And yes, there are assembler "compilers" (though an "assembler
compiler" is typically called "an assembler") written in assembler, but
there are also assembler compilers written in C, and possibly in Java.

	Similarly, there are C compilers written in C, but there may
also be C compilers written in assembler, and there's definitely C
compilers written in Java.

	And there are Java compilers and Java virtual machines written
in C, but there are also Java compilers and Java virtual machines
written in Java (see the SableCC and SableVM projects).

[...]
> Fine. Since Java is such a great language, let's see you write
> the BIOS for all new computers in it ... what? you mean all new
> computers will be bricks if you do? What a crap tool ...

	The fact that Sun's javac compiler takes Java as an input
language and emits JVM Bytecode as an output language is a
characteristic of the compiler, and not of the Java language itself.
There's no reason why you couldn't have a compiler take Java as an input
language, and machine code as an output language (The gcj compiler does
exactly this).

	I don't know what's involved in writing BIOSes, but I suspect
that if you can program a BIOS in software (as opposed to fiddling with
wiring at the hardware level), then you essentially need to "burn" a
bytestream representing the BIOS program into the FlashROM containing
the BIOS. Well, you can write a compiler which takes Java as its source
language, and emits the appropriate bytestream in whatever format the
FlashROM expects (which may or may not be machine code; I don't know).

	- Oliver


More information about the antlr-interest mailing list