What is Erlang written in?
Asked Answered
I

4

117

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.
Inhibitory answered 13/2, 2009 at 14:39 Comment(1)
Erlang is open source. Go check out the code and take a look!Beadledom
B
154

Erlang itself is written in Erlang. Sounds strange? Yes, because it is only partially true. OK look at it in more detail:

  1. Erlang preprocessor is written in Erlang.
  2. Erlang parser is written in Erlang.
  3. Erlang compiler to BEAM (byte-code VM) is written in Erlang.
  4. Erlang compiler to HiPE (native VM extension) is written in Erlang.
  5. Erlang VM BEAM and HiPE is written mostly in C.
  6. Linked-in drivers are written mostly in C. (They are plugged to VM and serves communication with outside world.)
  7. OTP is written in Erlang.
  8. Another ports or nodes can be written in any language.
Bunin answered 13/2, 2009 at 15:5 Comment(0)
E
98

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.

Ectoplasm answered 13/2, 2009 at 14:50 Comment(1)
Thanks! What is the source for this quote?Kohn
O
17
  • 65.9% of erlang code is written in Erlang.
  • 13.4% of erlang is written in XML.
  • 13.6% of erlang is written in C.
  • 1.4% of erlang is written in C++
  • ...

You can see a live and update statistics in ohloh site, this report generate from main erlang git repository.

Overstride answered 11/6, 2013 at 10:24 Comment(3)
I'm just curious which parts are written in c++.Immure
@Immure none, this is the false-positive in line counter filetype detection.Brabant
Parts of the WX bindings are written in C++.Cantor
C
0

I can say that Erlang was initially written in C/C++ as I can't say that Java is written in java.... but It's framework and Some libraries. About Erlang, As Its is preferred programming language and suitable for Telecom system... in order to maintain swiftness (e.g: in chat-bots) I know that its compiler or PreProcessor is written in Erlang. But Other features of language are written in Low Level languages.

Continence answered 22/11, 2019 at 12:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.