Prototypes and Prolog objects

In this page, the Javascript prototypes used for modelling Prolog's elements and methods can be found.


In order to represent the logical variables in a Prolog program, the prototype pl.type.Var is used. The only argument that the constructor receives is the id of the variable as a string.


The prototype pl.type.Term is used to represent atoms and composite terms in Prolog. The constructor receives a string identifying the term and, optionally, a list of Prolog objects (if the term is composite).

List are made up by ./2 terms, which receive a head and a tail, and the []/0 term, used to represent an empty list. For instance, the list [1,2,3] is analysed as '.'(1,'.'(2,'.'(3,[]))).