What is Erlang written in?
What is Ericsson's implementation of Erlang and Erlang/OTP written and compiled in? Is is assembly, C or Erlang itself?
Update 1: Thanks to DrJokepu. If I understand correctly, Erlang source-to-VM compiler is written in Erlang itself. But the VM is written in C.
Update 2: Hynek-Pichi-Vychodil pointed out a lot of details.
- VM and HW interacting drivers: in C.
- Compiler (to VM) and libraries: in Erlang.
- Extensions: Possible in any language by writing a port or an Erlang node in that language.
Erlang itself is written in Erlang. Sounds strange? Yes, because it is only partially true. OK look at it in more detail:
- Erlang preprocessor is written in Erlang.
- Erlang parser is written in Erlang.
- Erlang compiler to BEAM (byte-code VM) is written in Erlang.
- Erlang compiler to HiPE (native VM extension) is written in Erlang.
- Erlang VM BEAM and HiPE is written mostly in C.
- Linked-in drivers are written mostly in C. (They are plugged to VM and serves communication with outside world.)
- OTP is written in Erlang.
- Another ports or nodes can be written in any language.
From the Erlang FAQ:
10.6 How did the first Erlang compiler get written?
(or: how was Erlang bootstrapped?) In Joe's words:
First I designed an abstract machine to execute Erlang. This was called the JAM machine; JAM = Joe's Abstract Machine.
Then I wrote a compiler from Erlang to JAM and an emulator to see if the machine worked. Both these were written in prolog.
At the same time Mike Williams wrote a C emulator for the JAM.
Then I rewrote the erlang-to-jam compiler in Erlang and used the prolog compiler to compile it. The resultant object code was run in the C emulator. Then we threw away prolog.