Shahzad Bhatti Welcome to my ramblings and rants!

September 15, 2007

PROLOG roots in ERLANG

Filed under: Computing — bhatti @ 3:27 pm

I have been trying Erlang lately and since Erlang has a lot of its roots in PROLOG and its first VM (JAM) was written in PROLOG, I thought I would look at some similarities in syntax. So I picked up “PROLOG Though Examples by Kononenko and Lavrac”, which has been collecting dust on my bookshelf since 1989. Here are some similarities I found:

  • atoms or symbols start with lower case.
  • variables start with Uppercase or underscore (anonymous variables).
  • statements end with period.
  • structures are similar to records.
  • lists are declared same, with [1, 2, 3] syntax. Also, [Head|Tail] syntax is same.
  • strings are represented as array of ASCII codes.
  • arithmetic operators are same “> < >= =< =:= =\= div mod”
  • a lot of list functions are similar to BIFs in ERLANG such as member, conc (called append in ERLANG), insert, delete.
  • both can read terms from a file using consult function.

Despite all these similarities both languages are fundamentally different, as PROLOG was written for Expert systems and its interpreter took in facts and rules and deduced inferences and included sophisticated backtracking (e.g. cut) features. While, ERLANG is a functional language with strong support for concurrent and distributed applications.

No Comments

No comments yet.

RSS feed for comments on this post. TrackBack URL

Sorry, the comment form is closed at this time.

Powered by WordPress