PLDB
Languages Features Calendar About Lists Add Language
GitHub icon

Prolog

Prolog

Prolog is a programming language created in 1972 by Alain Colmerauer.

Prolog is a general-purpose logic programming language associated with artificial intelligence and computational linguistics. Prolog has its roots in first-order logic, a formal logic, and unlike many other programming languages, Prolog is intended as primarily a declarative programming language: the program logic is expressed in terms of relations, represented as facts and rules. A computation is initiated by running a query over these relations. Read more on Wikipedia...

Try now: Riju

#38on PLDB 50Years Old 51.5kUsers

Example code from Riju:

:- initialization main. main :- write("Hello, world!"), nl.

Example code from hello-world:

helloWorld :- write('Hello World'). :- helloWorld.

Example code from the Hello World Collection:

% Hello World in Prolog hello :- display('Hello World!') , nl .

Example code from Linguist:

%6.8 subset(Set, Subset) :- append(L1, Subset, Set). powerset(Set, Subset) :- bagof(Subset, subset(Set, Subset), Subset).

Example code from Wikipedia:

rule(q0, 1, q0, 1, right). rule(q0, b, qf, 1, stay).

Language features

Feature Supported Example Token
Binary Literals βœ“
% 0b[01]+
Integers βœ“
% \d\d?\'[a-zA-Z0-9]+
Floats βœ“
% (\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?
Hexadecimals βœ“
% 0x[0-9a-fA-F]+
Octals βœ“
% 0o[0-7]+
Case Sensitivity βœ“
Strings βœ“
'Hello world'
'
MultiLine Comments βœ“
/* A comment
*/
/* */
Print() Debugging βœ“ write
Line Comments βœ“
% A comment
%
Comments βœ“
Semantic Indentation Ο΄

Books about Prolog on goodreads

title author year reviews ratings rating
PROLOG: Programming for Artificial Intelligence Ivan Bratko 1986 4 166 3.75
Programming in PROLOG: Using the ISO Standard William F. Clocksin 1981 4 83 3.57
The Art of Prolog: Advanced Programming Techniques Leon Sterling 1994 2 22 3.91
The Art Of Prolog: Advanced Programming Techniques Leon Sterling 1986 2 43 3.79
Logic Programming with PROLOG Max Bramer 2005 0 16 3.56

Article source

PLDB - Build the next great programming language. v5.0.0 - Acknowledgements Β· Email Β· GitHub