jediknight•

People who find this interesting might also take a look at OMeta.

3
loup-vaillant•

While we're at it, here is my mandatory Shameless Plug™. I also wrote 30+ compilers, starting from MetaII, but did not publish them. Quite the enlightening exercise, I now understand much about top down parsing.

4
mycall•

Shameless Plug™

worth checking out, thanks!

1
CCSS•

Your version of metaII in Lua really makes things clear. Thanks!

1
crashandburn•

That whooshed over my head like a satellite. Can anyone please explain this compiler in a less terse way?

1
loup-vaillant•

First, there's the computer. It's a hunk of metal that can receive instructions and produce a result. It's an interpreter that can interpret machine language.

Then there are compilers. A compiler is a heap of binary data, that, when interpreted by the computer, will cause it to transform some input into a binary heap of data the computer can interpret.

Then there are self-hosting compilers. They're just like the compilers above, but some particular input will cause them to output a binary heap that's identical to themselves. At this point, we don't really care about the binary any more, we care about that particular input: the source code.

Most serious compilers are self hosting: Just like the compiler above, they are implemented in the same language than the one they can compile. GCC for instance can compile C is (was?) itself written in C.

The final stage is meta-compiling. A meta-compiler is a self-hosting compiler, whose source code is written in some DSL that's specialised in compiler construction. Though most of the time those compilers don't produce binary code directly, but some other encoding that other compilers (or interpreters) can understand.

Does that help?

4
crashandburn•

Thanks loup-vaillant. That does clear things a lot. I should do some reading on my about this too. It does seem quite interesting.

2
Poltras•

Technically a compiler goes from a higher level programming language to a lower one. If you stay at the same level, it should be called a transpiler ;-)

-4
ehaliewicz•

Technically, a compiler is a translator between any two languages.

Transpiler is a term that has grown in use to mean translating between two languages of similar abstraction, but it is by no means any more correct than compiler.

10