FunLog++ - introduction - glossary - language - library - special - semiknown - dynamic
FunLog++ Introduction
control operators - terms and denotations - SY1 - SY2 - SY3 - SY4 - SY5

FunLog++ is an object-oriented, functional, logic programming language plus unification. FunLog++ was created in 1995/1996 by the Pro.M.D. research group in Germany. In the Pro.M.D. project FunLog++ serves as a basic knowledge representation language for medical knowledge bases. FunLog++ syntax is simple but powerful as few independent concepts are combined orthogonally. FunLog++ semantic is very clear and we hope to detect a wide class of semantic errors during compile time. The standard library of FunLog++ is optimized to support biochemical and physiological knowledge. A system of competence levels is defined to deal with unknown, semiknown, known, and empty objects.

There are only few reserved symbols which are ::= ::- ( ) { } [ ] SELF , . The reserved variable name SELF occurs in formal and actual parameter positions and denotes the containing class. FunLog++ applies semanticextensible unification as its basic operation. In the current implementation, FunLog++ applies eager evaluation for most standard library functions and  lazy evaluation for few selected function parameters as there are the second parameters of control operators ,/2, ;/2, ,,/2, ;;/2, !/2, ::/2. Here we write F/N to express that function F has arity N, i.e. N parameters (e.g. --/2 means that operator -- has two parameters).

A FunLog++ program consists of a sequence of function definitions each of which consists of a head and a body. Function
 

  alpha ::= "Hello world".

accepts a parameterless message alpha and returns the result "Hello world".

The head of a FunLog++ function is a term used to specify a pattern of to be received messages. The body of a function is a method body or a class body. A method body is a term determining the return value of the method function. A class body serves for global program structuring and consists of a curly open bracket, a FunLog++ subprogram, and a closing curly bracket. Function
 

  gamma ::= { beta ::= zeta + 1.
              zeta ::= 2.       }.

accepts a message gamma:beta and returns the result "3". Operator :/2 sends the message in the second parameter to the receiver object in the first parameter position. So with gamma:beta the message beta is send to the receiver object denoted by gamma.

Public functions contain the definition symbol ::= to specifiy that these are also accessible from foreign classes, i.e. beyond the curly brackets. Private functions use the ::- symbol and are only accessible from within the same class.
 
FunLog++ control operators
control operators - terms and denotations - SY1 - SY2 - SY3 - SY4 - SY5

Control operator  ,/2 is used to sequencially evaluate terms. It first evaluates the left operand. If the left operand results failure then the whole term results failure. If the left operand returns success then the right operand is evaluated in order to yield the result of the whole term. In the following function dub/1 the parameter X is first doubled in Y=2*X and then converted to a text by display/1. The message dub(3) so will result in "6".
 

  dub(X)   ::= Y = 2*X, display(Y).

Control operator  ;/2 is used to alternatively evaluate terms. It first evaluates the left operand. If the left operand results sucess then the right operand is evaluated in order to yield the result of the whole term. If the left operand returns failure then the whole term results failure. In min/2 if X<Y then X is returned, otherwise Y is returned. The message min(33,77) thus will result in 33.
 

  min(X,Y) ::= X < Y, X; Y.

Control operator  !/2 is used to decide if some function has to accept a message. It first evaluates the left operand. If the left operand results sucess then the right operand is evaluated in order to yield the result of the whole term. If the left operand returns failure then the whole term results unaccepted. In abs/1 if X<0 suceeds then -X is returned by the first function. If X<0 fails then the body of the first term returns unaccepted. In this case the second function of abs/1 is tried which then returns X. A message abs(-99)thus will result in 99.
 

  abs(X)   ::= X < 0 ! -X.
  abs(X)   ::= X.

 
FunLog++ denotations and term structures
control operators - terms and denotations - SY1 - SY2 - SY3 - SY4 - SY5

FunLog++ denotations are texts, numbers and lists. FunLog++ numbers are sequences of digits, like 3.14 where decimals are separated by a point. FunLog++ texts are delimited by quotes, like "Hello". FunLog++ lists are sequences of terms separated by commata and enclosed in square brackets, like ["start", 123, "stop"].

FunLog++ terms may have zero or more parameters. If there are parameters then the functions may be of one of the following four structures depending on the position of the operator symbol:
 

four term structures with an example
functional term:
exp(5)
infix term:
2 + 1
prefix term:
- 5
postfix term:
20 %

Prefix-, infix- and postfix operators are ordered by priority in order to reduce need of round brackets and to enhance readability.


control operators - terms and denotations - SY1 - SY2 - SY3 - SY4 - SY5
FunLog++ - introduction - glossary - language - library - special - semiknown - dynamic
Last modification: B. Pohl 22.August 2000 / 05.November 2000