LOGLAN'82

USER'S GUIDE

Institute of Informatics University of Warsaw January 1988

revised October 1994 24/11/94 08:33 LITA Université de Pau

TABLE of CONTENTS

PREFACE 3 1.

USING LOGLAN-82 SYSTEM 3 1.1.

COMPILATION 3 1.2.

COMPILER SWITCHES 4 1.3.

CODE GENERATION 4 1.4.

PROGRAM execution 5 1.5.

COMPILE TIME ERRORS 6 1.6.

RUN-TIME ERRORS 6 2.

COMPILER OPTIONS 7 2.1.

OPTION FORMAT 7 2.2.

OPTIONS LIST 7 2.3.

FRAGMENTATION 8 3.

CURRENT LOGLAN-82 IMPLEMENTATION SPECIFICATION 9 3.1. IMPLEMENTED SUBSET OF LOGLAN 9 3.2. PREDEFINED LANGUAGE ELEMENTS 9 3.3. FILE SYSTEM 9 3.4. FILE VARIABLES 9 3.4.1. FILE GENERATION 10 3.5. FILE DEALLOCATION 10 3.6. GENERAL FILE OPERATIONS 10 3.7. TEXT FILES 11 3.8. BINARY SEQUENTIAL FILES 11 3.9. DIRECT ACCESS BINARY FILES 11 3.10. CONCURRENCY 12 3.10.1 INVOKING THE LOGLAN INTERPRETER FOR CONCURRENT ROGRAMS 12 3.10.2 RESTRICTIONS AND DIFFERENCES FROM THE REPORT 13 3.10.3 COMMUNICATION MECHANISM 14 3.11 SYSTEM SIGNALS 16 3.12. IMPLEMENTATION RESTRICTIONS 16 4. APPENDIX A : PREDEFINED CONSTANTS 17 5. APPENDIX B : PREDEFINED CLASSES 17 5.1. MOUSE 19 6. APPENDIX ) : PREDEFINED PROCEDURES AND FUNCTIONS 21 7. APPENDIX D : ERROR CODES 23 8. APPENDIX E : LOGLAN RUNTIME ERRORS 35 9. APPENDIX F : CHARACTER SET 37 10. BIBLIOGRAPHY 38 10.0.1. LOGLAN'82 38 10.0.2. Algorithmic Logic 41 10.0.3. Related literature 42

PREFACE

This document provides information necessary to compile and execute Loglan programs.

This manual assumes basic knowledge of Loglan-82 language, described in "Report on the Loglan Programming Language" (see Bibliography). to ToC

1. USING LOGLAN-82 SYSTEM

The following three steps are required to execute a Loglan program:

Compilation is accomplished by invoking Loglan compiler. This step creates two destination files: the intermediate code file(.lcd) and the listing file(.lst). The intermediate code file is the input file for the second step: generation of the code accepted by interpreter. In this step two files containing object code(.pcd & .ccd) are produced. They are the input files for the third step: interpretation. This step is equivalent to execution of a program. to ToC

1.1. COMPILATION

To invoke the Loglan compiler without specifying any command line parameters, type:

LOGLAN

Then the prompt appears on your terminal:

File name:

and the compiler waits for file specification.The default extension is LOG.

The compiler will produce (optionally) listing file with the same file name and the extension LST and will produce, if no error occurs, the code file with the extension LCD. Destination files will be stored on the same drive and directory as the source file.

Examples:

$ LOGLAN

File name: PROGRAM < ENTER>

Loglan compiler compiles program from PROGRAM.LOG file and creates PROGRAM.LCD.

$ LOGLAN A:PROGRAM.DAT

In this case the source file is A:PROGRAM.DAT. The file PROGRAM.LCD will be created on drive A.

$ LOGLAN /home/vous/PROGRAM2

If any error occurs, the code file is not produced. At the end of compilation the following message is printed:

< number of errors> error(s) detected

1.2. COMPILER SWITCHES

There are two possibilities to specify compiler's options: by compiler switches (i.e. external options) or by comments in the source program (see chapter 2.). You may enter the compiler switches in command line after file name in the following format:

where swi consists of character that designates the name of the option and either '+' or '-'.

Examples:

$ LOGLAN PROGRAM L- T+

$ LOGLAN PROGRAM The KBD directive

In this case the default switches values are assumed.

Scope of the switch is the entire program. All switches ,except H, correspond to options. A switch has greater priority then options: when you specify switch, all corresponding options inside source program will be ignored. Full description of each option is given in chapter 2.2. Switch L has additional significance. When this switch is set off no listing file is produced.

1.3. CODE GENERATION

In this step information from the intermediate code file is read and two destination files containing the code are produced. No switch is permitted for this step. To generate code files, type:

GEN < file name>

(or HGEN The KBD directive < file name> , if the switch H+ was specified for the compiler.(DOS/AT only))

You type file name without extension (extension is ignored).

Examples:

$ GEN

FILE_NAME: PROGRAM

Information is read from file PROGRAM.LCD from default drive and directory. Two destination files are produced: PROGRAM.CCD and PROGRAM.PCD and stored in the same directory as the input file.

$ GEN /home/vous/PROGRAM2

Files PROGRAM.CCD and PROGRAM.PCD are stored on drive A.

1.4. PROGRAM execution

To interprete (execute) the Loglan program you must invoke the interpreter INT or HINT (if tNe switch H+ was specified). File name must be specified in command line. The file extension is ignored. The interpreter reads input files with the given name and extensions CCD and PCD and executes the Loglan program.

The syntax for calling the interpreter is

INT < options> < file name>

or

HINT < options> < file name> (DOS/AT only)

The following options are supported:

/m < n > set memory size for Loglan program (in 16 bit words for small and 32 bit words for huge memory). For concurrent programs it means memory size for every process.

/i information about garbage collection-compactification is printed.

/r < n > used to invoke interpreter on nodes different from console (see 3.4.). option parameter is console node number (as defined by D-Link Network).

/d causes trace to be printed to the file with .TRD extension provided that the option or switch D+ was used during compiling.

At the end of interpretation the following message is printed:

End of LOGLAN-82 program execution

Examples:

$ LOGLAN \DAT\EXAMP.SRC, L+

The file \DAT\EXAMP.LCD and \DAT\EXAMP.LST are generated.

$ GEN \DAT\EXAMP

The files \DAT\EXAMP.CCD and \DAT\EXAMP.PCD are created.

Then the program can be interpreted by:

$ INT \DAT\EXAMP

1.5. COMPILE TIME ERRORS

The errors detected during the compilation are printed on the listing file, if this file is created. In the scope of option L- or if the switch L is set off only the incorrect lines and errors messages are printed . When the switch ( not option !) L is set off then listing file is not produced and incorrect lines and error messages are printed on the user's terminal.

Error message has the following format:

*** ln ERROR en txt id

where:

ln - index of incorrect line,

en - error's number (see Appendix B),

txt- text that explain type of the error,

id - identifier helpful to situate the error.

Error messages are printed in the source listing after incorrect lines.

For syntax errors (numbered 101-147, 201-212), sign '?' indicates the error's position in the line.

Error may be detected beyond the line containing it.

Identifier helpful to find an error is printed as soon as possible.

For codes 331-338 error message is printed after first line of virtual module declaration.

Errors like "undeclared identifier" are printed in each module once, after first reference to this identifier. Further references are ignored.

The errors related to case instruction may appear before the incorrect line.

1.6. RUN-TIME ERRORS

Loglan run-time errors are detected by Loglan run-time system. When any of these errors occurs, the appropriate system signal is raised and error message is printed if handler is not found. All of these error messages are described in Appendix C. moreover the line number of the last executed statement is printed on the user's terminal.

2. COMPILER OPTIONS

Options, like switches are used to pass some information to the compiler. Options are placed in source program in comments. Scope of options in source program is textual. Option may appear in any place of source program, but it is active from the beginning of the nearest instruction. Listing option L is active from the next line after line containing setting this option on up to the line containing setting this option off. Options overwrite defaults, but are overwritten by switches (external options). Option definition is not allowed before the keyword program.

2.1. OPTION FORMAT

Options may be placed in source program in comments in the following format:

(*$opt1,opt2,...*)

where opti consists of character that designates the option and either '+' or '-' e.g.: (*$L-,T+*). Options in one comment should be separated by commas. Spaces in such comment are not allowed.

2.2. OPTIONS LIST

D - trace

D+ - causes the line numbers of the executed instruction to be printed,

D- - default,

L - listing

L- - default, only incorrect lines are printed on the terminal

L+ - all lines are printed on the listing file

O - optimization

O+ - optimization of some arithmetical and logical expressions are included to generated code (default),

O- - generate code without optimization,

T - type conflict checking

T+ - default, dynamic checking of type conflict in assignment instructions and in parameter transmissions,

T- - no dynamic checking

H - memory model (switch only) APPLIES ONLY to PC/AT/XT !!

H- - default, small memory

H+ - huge memory

PC/AT/XT When H- is specified all code and data must fit into 64K

bytes. When H+ is specified all memory available on IBM PC

may be utilized, with the cost of increased execution time.

2.3. Fragmentation

It is possible to split one Loglan program into different files. The preprocessor puts together the fragments of a program coming from different files and enables in this way the a compilation and, later, an execution of the entire Loglan source.

In any place of Loglan text where it is possible to put semicolon (;) you can put aside the following compiler directive

#include < file>

It means that any two declarations of instructions can be separated by the directive. Do not forget however to end the preceding declaration or instruction by the semicolon.

Grammar

#include "{path> }< file name> " < CR> CR stands for end of line Carriage Return

Remarks

1. It may be a white space between the word 'include' and the character ".

2. You need not to specify the path to the included file if it is stored in the current directory, i.e. the one from which you began the compilation.

3. The ortography of path should correspond to the plateform used

(i.e. in DOS you use \ characters, in Unix it will be / character)

Example

program pr;
   var x: real;
 #include c:\loglan\examples\simulation.log

   unit c: class;
   end c;
begin
   read(x);
   ...
end

The content of the file c:\loglan\examples\simulation.log replaces the line include.

3. CURRENT LOGLAN-82 IMPLEMENTATION SPECIFICATION

3.1. IMPLEMENTED SUBSET OF LOGLAN

The following constructions described in the report of Loglan-82 have not been implemented:

- local attributes,

- separate compilation,

File system is described in 3.3.

3.2. PREDEFINED LANGUAGE ELEMENTS

Predefined constants, procedures and functions are added to the language (see Appendix A). Moreover keywords char (short form of character) and bool (short form of boolean) are added.

The character set, defined in the report of Loglan-82, is extended by lower-case letters and the tabulation character (decimal code 9). It is possible to use operator '< > ' which stands for 'not equal'.

3.3. FILE SYSTEM

Loglan contains the predefined reference type file and a set of statements and standard procedures to manipulate files. Both sequential and direct access files are implemented.

3.4. FILE VARIABLES

Variables of the type file can be declared in the Loglan program and can be used as any variables of a reference type.

Example:

 var f:file, 
A:arrayof file; 

unit p:procedure(f:file); ... end p; 
begin 
       ...... 
       f := A(i); 
       ...... 
end; 

3.4.1. FILE GENERATION

A file object is generated by open statement of the form:

open(f,T) for internal files or

open(f,T,A) for external files

where

f is a file variable,

T = text for text files,

char for binary sequential files of character,
integer integer or

real real values

direct for direct access binary files.

A is an expression of the type arrayof char designating external file name. After execution of open statement the new file object is created and it becomes a value of the file variable f. If the file is opened as an external one, then it references to the file A.

Example:

open(data,text) - new internal text file data is opened

open(num ,integer) - new internal binary file num is opened

(the file components are integer numbers)

open(f,text,unpack("my.dat")) - external text file f is opened;

it references to the file my.dat stored on the default drive and directory.

open(f,direct,A) - an external direct access file with name in array A is opened.

3.5. FILE DEALLOCATION

The file can be closed and deallocated by execution of the statement kill.

3.6. GENERAL FILE OPERATIONS

There are three standard procedures associated with files: RESET, REWRITE and UNLINK.

call RESET(f) rewinds the file f. After execution of RESET on sequential files only read/get operations are available.

call REWRITE(f) creates a new empty file. After execution of REWRITE on sequential files only write/put operations are available.

call UNLINK(f) closes and deletes file f. File object is deallocated and f is set to one.

RESET or REWRITE must be performed on the file opening before the first I/O operation on it.

3.7. TEXT FILES

The following operations are available to text files: read, readln, eoln, write, writeln, eof. The first parameter of the operation is a file variable. If it is omitted, then a standard input/output file assigned to user's terminal is used.

Example:

   read(f,a,b); 
read(c); 
writeln(g," .... "); 
if eof(f) then .... 

For more information see [1].

3.8. BINARY SEQUENTIAL FILES

Any file created with the parameter T = integer, real or char is a binary one. It is a sequence of components of the type T. Only objects of type T can be read from or written to this file.

The following operations are available to binary files:

put(f, w1, ..., wn)

get(f, x1, ..., xn)

eof(f)

where f is a file opened with the type T, wi is an expression of the type T and xi is a variable of the type T.

The statement put(f, w1, ..., wn) writes the components w1, ...,wn to the file f. The statement get(f, x1, ..., xn) reads the next n components from the file f and assigns them to the variables x1, ..., xn. The statement eof is the same as for text files.

3.9. DIRECT ACCESS BINARY FILES

Direct access files are treated as a sequence of bytes without any interpretation. Operations RESET and REWRITE prepare a file for both reading and writing. RESET is used for existing files,

REWRITE for the new ones.

The following additional operations are available:

call SEEK(f, offset, base) - moves the file pointer to the position designated by offset relative to base.

Offset is a signed integer specifying the number of bytes.

Possible values for base are:

0 - begining of file,

1 - current position of file pointer,

2 - end of the file.

Examples:

call SEEK(f, 0, 0) - rewinds file f,

call SEEK(f, -3, 1) - backspaces file f by 3 bytes,

call SEEK(f, 0, 2) - moves the file pointer to the first byte after end of file

POSITION(f) - returns current position of the file pointer associated with f.

PUTREC(f, A, n) - where A is an array of any primitive type and n is an integer variable. Let k be the number of bytes occupied by elements of array A. This operation writes min(k, n) bytes from A to the file f and advances file pointer by the number of written bytes. The number of bytes written to the file is returned in the variable n.

GETREC(f, A, n) - where A is an existing array of any primitive type and n is an integer variable. Let k be the number of bytes occupied by elements of array A This operation reads min(k,n) bytes (or less, if end of file is encountered) from the file and advances the file pointer by the number of read bytes. The number of bytes read from the file is returned in the variable n.

3.10. CONCURRENCY

Implemented concurrency mechanisms differ much from those described in the LOGLAN-82 report []. In particular, only distributed processes are implemented, so they cannot communicate through shared variables. For this reason semaphores had to be replaced by an entirely new communication mechanism. Such a mechanism has been designed and it is based on the rendez-vous schema.

3.10.1. INVOKING THE LOGLAN INTERPRETER FOR CONCURRENT PROGRAMS

A concurrent LOGLAN program may run on a single computer with concurrency simulated by time slicing. In this case LOGLAN interpreter is invoked as usual. One must only remember that /m optional parameter (see 1.4.) denotes memory size for each process rather than for the whole program.

To achieve true parallel (multiprocessor) execution, a network of IBM PC computers may be used. For the time being, only D-Link Network Version 3.21 is supported. In order to run a LOGLAN program in the network environment take the following steps:

1) make sure that every node is logged on,

2) select arbitrarily one node as a console,

3) invoke the LOGLAN interpreter on every node except the console, giving it /r option with the console node number (see 1.4.). You must give the same program file to all interpreters. Most conveniently it may be achieved by accessing a file on a disk connected through the network to each node.

4) invoke the interpreter on the console without the /r option (in the usual way). Give it the same program file as above.

After the last step the main program process begins its execution on the console node. Other processes may be created dynamically on any node on which an interpreter is running.

Regardless of the fact whether the network is used or not, more than one process may be executed on the same computer.

3.10.2. RESTRICTIONS AND DIFFERENCES FROM THE REPORT

All processes (even those executed on the same computer) are implemented as distributed, i.e. without any shared memory. This fact implies some restrictions on how processes may be used. Not all restrictions are enforced by the present compiler, so it is the programmer's responsibility to respect them. This is the list of restrictions:

1) all process units must be declared as global, i.e. directly inside the main program,

2) a process cannot access global variables (except for the main program process),

3) any remote access to a process object other than a procedure call is inhibited

4) each parameter of

a process,

a procedure called by remote access to a process object,

a procedure parameter of a process,

must be one of the following:

a value of the primitive type (INTEGER, REAL, CHAR, BOOLEAN, STRING)

a procedure declared directly inside a process

a procedure which is a formal parameter of a process

any reference to a process object.

This restriction implies that references to objKcts other than processes have only local meaning (in a single process) and cannot be passed among the processes.

5) comparisons, IS, IN and QUA operations are not allowed for the references to processes.

6) operations which require dynamic type checking on the references to processes are not allowed.

7) a process may be attached only by a proper coroutine generated by it.

8) the variable MAIN is accesible only in the main program process.

The following concurrent constructs described in the report are not implemented at all:

- semaphores and all operations on them

- the WAIT expression.

Semantics of the NEW generator is slightly modified when applied to the processes. The first parameter of the first process unit in the prefix sequence must be of type INTEGER. This parameter denotes the node number of the computer on which this process will be created. For a single computer operation this parameter must be equal to 0.

Example:

unit A:class(msg:string);
...
end A;
unit P:A process(node:integer, pi:real);
...
end P;
...
var x:P;
...
begin...
 (* Create process on node  4.  The  first  parameter  is  the  *) 
 (* string required by the prefix A, the second is the node number *)
 x := new P("Hello", 4, 3.141592653);
...
end

.

The following parallel constructs are implemented as defined in the report:

- KILL operation for a process

- RESUME statement

- STOP statement without parameter.

3.10.3. COMMUNICATION MECHANISM

Processes may communicate and synchronize by a mechanism based on rendez-vous. It will be referred to as "alien call" in the following description.

An alien call is either:

- a procedure (or function) call performed by a remote access to a process object, or

- a call of a procedure which is a formal parameter of a process, or

- a call of a procedure which is a formal parameter of an alien-called procedure (this is a recursive definition). Every process object has an enable mask. It is defined as a subset of all procedures declared directly inside a process unit or any unit from its prefix sequence (i.e. subset of all procedures that may be alien-called).

A procedure is enabled in a process if it belongs to that process' enable mask. A procedure is disabled if it does not belong to the enable mask.

Immediately after generation of a process object its enable mask is empty (all procedures are disabled).

Semantics of the alien call is different from the remote call described in the report. Both the calling process and the process in which the procedure is declared (i.e. the called process) are involved in the alien call. This way the alien call may be used as a synchronization mechanism.

The calling process passes the input parameters and waits for the call to be completed.

The alien-called procedure is executed by the called process. Execution of the procedure will not begin before certain conditions are satisfied. First, the called process must not be suspended in any way. The only exception is that it may be waiting during the ACCEPT statement (see below). Second, the procedure must be enabled in the called process.

When the above two conditions are met the called process is interrupted and forced to execute the alien-called procedure (with parameters passed by the calling process).

Upon entry to the alien-called procedure all procedures become disabled in the called process.

Upon exit the enable mask of the called process is restored to that from before the call (regardless of how it has been changed during the execution of the procedure). The called process is resumed at the point of the interruption. The execution of the ACCEPT statement is ended if the called process was waiting during the ACCEPT (see below).

At last the calling process reads back the output parameters and resumes its execution after the call statement.

The process executing an alien-called procedure can easily be interrupted by another alien call if the enable mask is changed.

There are some new language constructs associated with the alien call mechanism. The following statements change the enable mask of a process:

ENABLE p1, ..., pn

enables the procedures with identifiers p1, ..., pn. If there are any processes waiting for an alien call of one of these procedures, one of them is chosen and its request is processed. The scheduling is done on a FIFO basis, so it is strongly fair. The statement:

DISABLE p1, ..., pn

disables the procedures with identifiers p1, ..., pn.

In addition a special form of the RETURN statement:

RETURN ENABLE p1, ..., pn DISABLE q1, ..., qn

allows to enable the procedures p1, ..., pn and disable the procedures q1,...,qn after the enable mask is restored on exit from the alien-called procedure. It is legal only in the alien-called procedures (the legality is not enforced by the compiler).

A called process may avoid busy waiting for an alien call by means of the ACCEPT statement:

ACCEPT p1, ..., pn

adds the procedures p1, ..., pn to the current mask, and waits for an alien call of one of the currently enabled procedures. After the procedure return the enable mask is restored to that from before the ACCEPT statement.

Note that the ACCEPT statement alone (i.e. without any ENABLE/DISABLE statements or options) provides a sufficient communication mechanism. In this case the called process may execute the alien-called procedure only during the ACCEPT statement (because otherwise all procedures are disabled). It means that the enable mask may be forgotten altogether and the alien call may be used as a pure totally synchronous rendez-vous. Other constructs are introduced to make partially asynchronous communication patterns possible.

3.11. SYSTEM SIGNALS

System signals are connected to runtime errors (see APPENDIX C).

These signals are the following:

ACCERROR - reference to non existing object, CONERROR - array index outside the range or lower bound is greater than upper bound during array object generation, LOGERROR - errors related to control transfer, MEMERROR - memory overflow, NUMERROR - errors related to arithmentic operations like division by zero, floating point overflow, TYPERROR - type conflict in assignment statement, during parameter tran smission or headline conflict for actual parameter function and procedure. SYSERROR - errors related to file system, like reading after writing, too many files etc.

3.12. IMPLEMENTATION RESTRICTIONS

- Text line in source program can't be longer than 80 characters. - Maximal length of identifier is 20 characters, but entire length of all identifiers and keywords should be less than 3000 characters. - String constant can't be longer than 260 characters. - For case instructions: - up to 6 levels of nested case instructions are allowed, - range of labels can't be greater than 160. - Number of formal parameters can't be greater than 40, whereas up to 35 output or input parameters are allowed. Total number of formal parameters and variables declared in one module can't be greater than 130. - Number of array indices (i.e. arrayof) can't be greater than 63, - Standard type integer has the range (-32767,+32767) for small memory (16 - bit word). For huge memory (32-bit word) the range is (-2147483647,+2147483647), but values of constant expressions in a program must lie within the range (-2767, 32767). - Real numbers have the range (-8.43E-37, 3.37E+38) with 24-bit mantissa and 8-bit exponenet for small memory , giving about 7 digits of precision. For huge memory the range is (4.19E-307, 1.67E+308) with 53-bit mantissa and 11-bit exponent, giving about 15 digits of precision.Values of constant expression in a program must lie in the range (-8.43E-37, 3.37E+38). Warning

Compiler computes values of expressions built from constants without range checking. It means, that integer overflow, floating point overflow or underflow cause incorrect result without any message.

APPENDIX A : PREDEFINED CONSTANTS

INTSIZE

The size in bytes of integer variables

REALSIZE

The size in bytes of real variables

APPENDIX B : PREDEFINED CLASSES

of GRAPHICS & MOUSE

for PC486 for Unix for PC286

APPENDIX C : PREDEFINED PROCEDURES AND FUNCTIONS

ENDRUN:procedure;
Terminates program execution (ABORT).
RANSET:procedure(x:real);
Initializes random generator (for RANDOM function)
RANDOM:function:real;
Generates uniformly distributed pseudo-random numbers in the interval (0,1).
SQRT:function(x:real):real;
Computes square root of parameter x.
SIN:function(x:real):real;
Computes sinus of parameter x.
COS:function(x:real):real;
Computes cosinus of parameter x.
TAN:function(x:real):real;
Computes tangens of parameter x.
EXP:function(x:real):real;
Computes e**x.
LN:function(x:real):real;
Computes natural logarithmus of parameter x.
ATAN:function(x:real):real;
Computes arcus tangens of parameter x.
ENTIER:function(x:real):integer;
Computes entier part of parameter x.
ROUND:function(x:real):integer;
Computes rounded value of parameter x: ROUND(x)=ENTIER(x+0.5).
IMIN:function(x, y:integer):integer;
Computes minimum of two parameters.
IMAX:function(x, y:integer):integer;
Computes maximum of two parameters.
IMIN3:function(x, y, z:integer):integer;
Returns the minimum of three parameters.
IMAX3:function(x, y, z:integer):integer;
Returns maximum of three parameters.
ISHFT:function(x, k:integer):integer;
Logically shifts x by k bits: left, when k is positive, right otherwise.
IAND:function(n, k:integer):integer;
Returns logical product of parameters (on all bits).
IOR:function(n, k:integer):integer;
Returns logical sum of parameters (on all bits).
XOR:function(n, k:integer):integer;
Returns exlusive sum of parameters (on all bits).
INOT:function(n:integer):integer;
Returns logical complement of parameters (on all bits).
ORD:function(c:char):integer;
Returns number that represents character c (see APPENDIX F).
The following equations are satisfied: CHR(ORD(c)) = c & ORD(CHR(n)) = n
CHR:function(n:integer):char;
Returns character represented by parameter n (see APPENDIX F).
UNPACK:function(s:string):arrayof char;
Returns address of new array object containing characters of the string s.
MEMAVAIL:function:integer;
Returns the size of available memory in the current process (in words).
EXEC:function(cmd:arrayof char):integer;
Calls secondary command processor with cmd as a command string. Exit code is returned as a value of EXEC. TIME:function: integer;
Returns an integer value indicating the amount of central processor
time in seconds used by current process.
RESET:procedure(f:file);
Positionnes file f at the first component and readies it to reading.
REWRITE:procedure(f:file);
Positionnes file f at the first component and readies it for output.
The file f becomes empty (eof(f) = true).
UNLINK:procedure(f:file);
Closes and deletes file f (see 3.3.4)
SEEK:procedure(f:file; offset, base:integer);
Positiones file pointer (see 3.3.7)
POSITION:function(f:file):real;
Reads position of file pointer (see 3.3.7)

appendix D: Error Codes APPENDIX E : LOGLAN RUNTIME ERRORS

In the following list system signal name, raised after detection of runtime error, is placed in brackets.

ARRAY INDEX ERROR (CONERROR)

Index outside range during reference to array variable. NEGATIVE STEP VALUE (CONERROR)

SL CHAIN CUT OFF (LOGERROR)

Control transfer to object that has SL link cut off earlier in the consequence of kill operation. ILLEGAL ATTACH (LOGERROR)

The value of parameter of attach instruction is none or object differs from coroutine. ILLEGAL DETACH (LOGERROR)

An attempt to return by detach to coroutine that has been dealocated (by kill). ILLEGAL RESUME (LOGERROR)

An attempt to resume an object which is not a process or a process which is running. TOO MANY PROCESSES ON ONE MACHINE (SYSERROR)

Number of processes existing on one computer is greater than 64. INVALID NODE NUMBER (SYSERROR)

An attempt to create a process on a computer which is not connected to network. IMPROPER QUA (LOGERROR)

Error during computing expression of the form: ...x qua a, when 'x' references to none or 'a' doesn't prefix dynamic type object, which is value of 'x'. ILLEGAL ASSIGNMENT (TYPERROR)

Type conflict between left and right side of assignment instruction. FORMAL TYPE MISSING (LOGERROR)

Formal type is not accessible because of SL cut off. ILLEGAL KILL (LOGERROR)

An attempt to deallocate object in SL chain of active object. ILLEGAL COPY (LOGERROR)

An attempt to copy non terminated object (i.e. class before execution of return statement, coroutine before execution of end statement...). REFERENCE TO NONE (ACCERROR)

An attempt to remote access (by dot) to attributes of non existing object: dealocated or not generated. MEMORY OVERFLOW (MEMERROR)

INCOMPATIBLE HEADERS (TYPERROR)

Actual parameter list of generated object (procedure, function or class) is incompatible with formal parameter list from module declaration or formal function type is incompatible with actual function type. INCORRECT ARRAY BOUNDS (CONERROR)

An attempt to generate dynamic array object, when lower bound of index range is greater than upper bound.

DIVISION BY ZERO (NUMERROR)

COROUTINE TERMINATED (LOGERROR)

An attempt to transfer control to a terminated coroutine. COROUTINE ACTIVE (LOGERROR)

An attempt to transfer control to an active coroutine. HANDLER NOT FOUND (LOGERROR)

There is no handler for signal declared by user. ILLEGAL RETURN (LOGERROR)

An attempt to execute return instruction in handler serving system signal. UNIMPLEMENTED STANDARD PRC. (LOGERROR)

Standard procedure or function is not implemented. FORMAL LIST TOO LONG (MEMERROR)

Formal parameter list is greater than 40. ILLEGAL I/O OPERATION (SYSERROR)

Reading after writing, the type of the read/write parameter does not match the type of the file etc. I/O ERROR (SYSERROR)

System error during I/O. CANNOT OPEN FILE (SYSERROR)

INPUT DATA FORMAT BAD (SYSERROR)

SYSTEM ERROR (SYSERROR)
Should not occur. UNRECOGNIZED ERROR

APPENDIX F : CHARACTER SET

At the top of the table are hexadecimal digits (0 to 7), and to the left of the table are hexadecimal digits (0 to F). Hexadecimal code of ASCII character is constructed by contatenation of column label and row label. For example, the value of character representing the plus sign is 2B.

                   0     1     2     3     4     5     6     7 
                _________________________________________________ 
                !     !     !     !     !     !     !     !     ! 
          0     ! NUL ! DLE ! SP  !  0  !  @  !  P  !     !  p  ! 
                _________________________________________________ 
                !     !     !     !     !     !     !     !     ! 
          1     ! SOH ! DC1 !  !  !  1  !  A  !  Q  !  a  !  q  ! 
                _________________________________________________ 
                !     !     !     !     !     !     !     !     ! 
          2     ! STX ! DC2 !  "  !  2  !  B  !  R  !  b  !  r  ! 
                _________________________________________________ 
                !     !     !     !     !     !     !     !     ! 
          3     ! ETX ! DC3 !  #  !  3  !  C  !  S  !  c  !  s  ! 
                _________________________________________________ 
                !     !     !     !     !     !     !     !     ! 
          4     ! EOT ! DC4 !  $  !  4  !  D  !  T  !  d  !  t  ! 
                _________________________________________________ 
                !     !     !     !     !     !     !     !     ! 
          5     ! ENQ ! NAK !  %  !  5  !  E  !  U  !  e  !  u  ! 
                _________________________________________________ 
                !     !     !     !     !     !     !     !     ! 
          6     ! ACK ! SYN !  &   !  6  !  F  !  V  !  f  !  v  ! 
                _________________________________________________ 
                !     !     !     !     !     !     !     !     ! 
          7     ! BEL ! ETB !  '  !  7  !  G  !  W  !  g  !  w  ! 
                _________________________________________________ 
                !     !     !     !     !     !     !     !     ! 
          8     ! BS  ! CAN !  (  !  8  !  H  !  X  !  h  !  x  ! 
                _________________________________________________ 
                !     !     !     !     !     !     !     !     ! 
          9     ! HT  ! EM  !  )  !  9  !  I  !  Y  !  i  !  y  ! 
                _________________________________________________ 
                !     !     !     !     !     !     !     !     ! 
          A     ! LF  ! SUB !  *  !  :  !  J  !  Z  !  j  !  z  ! 
                _________________________________________________ 
                !     !     !     !     !     !     !     !     ! 
          B     ! VT  ! ESC !  +  !  ;  !  K  !  [  !  k  !  {  ! 
                _________________________________________________ 
                !     !     !     !     !     !     !     !     ! 
          C     ! FF  ! FS  !  ,  !  <   !  L  !  \  !  l  !  |  ! 
                _________________________________________________ 
                !     !     !     !     !     !     !     !     ! 
          D     ! CR  ! GS  !  -  !  =  !  M  !  ]  !  m  !  }  ! 
                _________________________________________________ 
                !     !     !     !     !     !     !     !     ! 
          E     ! SO  ! RS  !  .  !  >   !  N  !  ^  !  n  !  ~  ! 
                _________________________________________________ 
                !     !     !     !     !     !     !     !     ! 
          F     ! SI  ! US  !   / !  ?  !  O  !   _ !  o  ! DEL ! 
                _________________________________________________ 

. where:

     NUL  Null	DLE  Data Link Escape 
     SOH  Start of Heading	DC1  Device Control 1 
     STX  Start of Text	DC2  Device Control 2 
     ETX  End of Text	DC3  Device Control 3 
     EOT  End of Transmission	DC4  Device Control 4 
     ENQ  Enquiry	NAK  Negative Acknowledge 
     ACK  Acknowledge	SYN  Synchronous Idle 
     BEL  Bell	ETB  End of Transmission Block 
     BS   Backspace	CAN  Cancel 
     HT   Horizontal Tabulation	EM   End of Medium 
     LF   Line Feed	SUB  Substitute 
     VF   Vertical Tab	ESC  Escape 
     FF   Form Feed	FS   File Separator 
     CR   Carriage Return	GS   Group Separator 
     SO   Shift Out	RS   Record Separator 
     SI   Shift In	US   Unit Separator 
     SP   Space	DEL  Delete 

Bibliography

16 LITA, Pau Loglan'82 user's manual Loglan'82 users's manual November 24, 1994 15