This document is helpful for people who want to implement a new FunLog++
code generator or who want to maintain the original FunLog++ system software.
This document might be helpful to some minor extent for system programmers
who want to integrate the FunLog++ interpreter into a new environment or
who want to understand the architecture of the FunLog++ interpreter.
The FunLog++ interpreter was developed as part of the Pro.M.D. system.
It cooperates with a frontend program for user interaction and a SQL database
system in order to store permanent results.
interpreter
compiler
syntactic analyser
|
syntax tree
|
semantic analyser
|
semantic list
|
code generator
|
|
code file
|
executer
deductor (reads SQL)
|
result list
|
effector (writes SQL)
|
|
The FunLog++ interpreter consists of two main parts:
-
The FunLog++ compiler reads a source file and generates a target
code file.
-
The FunLog++ executer reads one or more code files and stores or
displays results according to the main message.
FunLog++ compiler
The FunLog++-compiler serves two alternative functions, generating target
language code and generating source file listings.
Generating target language code
This compiler function needs three consecutive steps:
-
The syntactic analyser reads a source file and builds up a syntactic
tree.
-
The semantic analyser converts the syntactic tree into a semantic
list.
-
The code generator convers the semantic list into the target code
file.
The source file may be of one of three different types:
-
A FunLog++ source file with extension ".FUN".
-
A Pro.M.D. source file with extension ".RUL".
-
A Prolog subset source file with extension ".PL" (not yet).
The target file may be of one of three different types:
-
A Prolog code file with extension ".LPA" or ".QOF".
-
A Java code file with extension ":JAVA".
-
A Delphi Pascal code file with extension ".PAS".
Generating source file listings
The FunLog++ compiler can output source listing files for the three
different types of input:
-
A FunLog++ listing output as plain text "*.FLI".
-
A Pro.M.D. listing output as plain text "*.RLI".
-
A Prolog++ listing output as plain text "*.PLI" (not yet).
In future syntactic analysis and listing output will be enhanced in order
to also read and write HTML/XML files.
The FunLog++ compiler is called as a side effect of the root(FILE)
message
if there is no appropriate code file accessible for FILE. This is true
for the main message like fun.exe MainMessage as well as
for root/1 messages in FunLog++ source files, e.g.
fun.exe root("lipid.fun"):layout("search").
or
name ::= root("descriptor.fun"):name.
FunLog++ executer
The FunLog++ executer consists of two consecutive subprograms, the deductor
and the effector:
-
The FunLog++ deductor reads one or more code files and generates
the result list according to the main message.
-
The FunLog++ effector put texts in files, database fields or dialog
windows according to the result list.
FunLog++ deductor
The FunLog++ deductor typically consists of three main parts:
-
The runtime starter loads all standard libraries and executes the
FunLog++ main message.
-
The runtime engine provides for a set of elementary calculations
(e.g. for platform functions)..
-
The runtime library defines standard functions in classes like failure/1,
known/1, semiknown/1, or unknown/1.
The deductor may have no side effects. But its result usually is a list
of read and write commands which determines which data objects should be
stored in which file or database or should be displayed in which window.
FunLog++ effector
The FunLog++-effector is not yet implemented. In future its task will
be to execute those list of store- and display commands which was returned
as the result from the deductor. The effector is responsible for correct
multiuser access and transaction control.
The effector has to be run immediately after the deductor. Additionally
to the list of store- and display commands the effector receives the list
of all external read access from the deductor in order to re-check the
proper input-output relation before results are stored.
The overall task of the executer is then to be performed in usually
steps:
-
Call the FunLog++ deductor and obtain the read-list and the write-list
-
Lock all locations and check-read all data from the deductor's read list
and write list.
-
If check-read differs from primary-read then unlock all locations of the
read- and write-list and repeat from step 1.
-
If check-read is identical to primary-read then store all result text in
the wanted locations and unlock all.
-
Executer is ready.