PLDB
Languages Features Calendar About Lists Add Language
GitHub icon

Erlang

Erlang

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

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...

Try now: Riju

#34on PLDB 36Years Old 27.1kUsers

Example code from Riju:

-module(main). -export([main/0]). main() -> io:fwrite("Hello, world!\n").

Example code from hello-world:

-module(erlang_hw). -export([start/0]). start() -> io:format("Hello World~n").

Example code from the Hello World Collection:

%% Hello World in Erlang -module(hello). -export([hello/0]). hello() -> io:format("Hello World!~n", []).

Example code from Linguist:

#!/usr/bin/env escript -export([main/1]). main([]) -> io:format("Hello, World!~n").

Example code 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).

Keywords in Erlang

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 Example Token
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).
File Imports โœ“
-include("my_records.hrl").
-include("incdir/my_records.hrl").
-include("/home/user/proj/my_records.hrl").
-include("$PROJ_ROOT/my_records.hrl").
-include_lib("kernel/include/file.hrl").
Directives โœ“
-define(TIMEOUT, 200).
...
call(Request) ->
   server:call(refserver, Request, ?TIMEOUT).
-undef(Macro).
Comments โœ“
% hello world program
Shebang โœ“
#!/usr/bin/env escript
Strings โœ“
"hello world"
Semantic Indentation ฯด
MultiLine Comments ฯด

Trending Erlang repos on GitHub

repo stars description
emqx 4937 EMQ X Broker - Scalable Distributed MQTT Message Broker for IoT in 5G Era
rabbitmq-server 6212 Open source multi-protocol messaging broker

Books about Erlang on goodreads

title author year reviews ratings rating
Programming Erlang Joe Armstrong 2007 34 643 3.97
ERLANG Programming Francesco Cesarini 2009 10 190 4.06
Concurrent Programming ERLANG Joe Armstrong 1995 2 15 4.00
Introducing Erlang: Getting Started in Functional Programming Simon St. Laurent 2012 4 41 3.95
ERLANG and Elixir for Imperative Programmers Wolfgang Loder 0 1 3.00
Concurrent Programming in ERLANG Joe Armstrong 1993 1 2 4.50

Article source

PLDB - Build the next great programming language. v5.0.0 - Acknowledgements ยท Email ยท GitHub