Top 1,000 Features Creators Resources Extensions Blog Explorer CSV Download
GitHub icon


< >

Erlang is an open source programming language created in 1986 by Joe Armstrong and Robert Virding and Mike Williams.

#34on PLDB 38Years Old 29kRepos
Download source code:
git clone

Try now: Riju

Erlang ( ER-lang) is a general-purpose, concurrent, functional programming language, as well as a garbage-collected runtime system. The term Erlang is used interchangeably with Erlang/OTP, or OTP, which consists of the Erlang runtime system, a number of ready-to-use components mainly written in Erlang, and a set of design principles for Erlang programs. The Erlang runtime system is known for its designs that are well suited for systems with the following characteristics: Distributed Fault-tolerant Soft real-time, Highly available, non-stop applications Hot swapping, where code can be changed without stopping a system. Read more on Wikipedia...

Example from Compiler Explorer:
-module(square). -export([square/1]). square(A) -> A*A.
Example from Riju:
-module(main). -export([main/0]). main() -> io:fwrite("Hello, world!\n").
Example from hello-world:
-module(erlang_hw). -export([start/0]). start() -> io:format("Hello World~n").
%% Hello World in Erlang -module(hello). -export([hello/0]). hello() -> io:format("Hello World!~n", []).
Example from Linguist:
#!/usr/bin/env escript -export([main/1]). main([]) -> io:format("Hello, World!~n").
Example from Wikipedia:
%% Second version -module(counter). -export([start/0, codeswitch/1]). start() -> loop(0). loop(Sum) -> receive {increment, Count} -> loop(Sum+Count); reset -> loop(0); {counter, Pid} -> Pid ! {counter, Sum}, loop(Sum); code_switch -> ?MODULE:codeswitch(Sum) end. codeswitch(Sum) -> loop(Sum).
Erlang Keywords
after and andalso begin bnot bor bsl bsr bxor case catch cond div end fun if let not of or orelse receive rem try when xor

Language features

Feature Supported Token Example
Integers โœ“
% [+-]?(?:[2-9]|[12][0-9]|3[0-6])#[0-9a-zA-Z]+
Floats โœ“
% [+-]?\d+.\d+
Conditionals โœ“
Functions โœ“
Print() Debugging โœ“ io:format
Message Passing โœ“
Line Comments โœ“ %
% A comment
Macros โœ“
-define(Const, Replacement).
-define(Func(Var1,...,VarN), Replacement).
hasExports โœ“
-export([start/0, codeswitch/1]).
File Imports โœ“
Directives โœ“
-define(TIMEOUT, 200).
call(Request) ->
   server:call(refserver, Request, ?TIMEOUT).
Comments โœ“
% hello world program
Shebang โœ“
#!/usr/bin/env escript
Strings โœ“
"hello world"
Case Insensitive Identifiers X
Semantic Indentation X
MultiLine Comments X

View source

- Build the next great programming language ยท About ยท Acknowledgements ยท Part of the World Wide Scroll