Fundamental research: Różnice pomiędzy wersjami

Z Lem
Skocz do: nawigacji, wyszukiwania
(Part II Axiomatic definitions of sublanguages of Loglan'82)
Linia 31: Linia 31:
  
 
== Part II Axiomatic definitions of sublanguages of Loglan'82 ==
 
== Part II Axiomatic definitions of sublanguages of Loglan'82 ==
Here we shall present a increasing sequence of sublanguages Li of Loglan'82. For each language we shall present its grammar and a semantics as defined by some axioms and inference rules.
+
Here we shall present an increasing sequence of sublanguages <math>\mathcal{L}\subset</math>Li of Loglan'82. For each language we shall present its grammar and a semantics as defined by some axioms and inference rules.
 
=== Program ===
 
=== Program ===
 
Program in Loglan'82 has the following structure<br />
 
Program in Loglan'82 has the following structure<br />

Wersja z 18:09, 29 maj 2014

Work on programming language Loglan'82 and its compiler was accompanied by vivid discussion and fundamental research. On these pages we shall report some of results as well as an attempt to define an axiomatic semantics of Loglan'82.

Problems and reports

Safe dealocation of objects

The problem is how to dealocate unused objects in a safe way? Some programming languages (Pascal, C++) allow to use instruction delete(x). Other languages (Java, Python) forbid such instructions and relay on the garbage collection gc(). In this way the Java's object management system gains safety but becomes much less controlled. It may happen that another danger named memory leakage will appear. We are happy to present you the object managing system invented by Antoni Kreczmar. In his system one can use the instruction kill(x) in order to dealocate an object being the value of the variable x.

The axiom of kill reads

[math](x=y=z \neq none) \implies \{\mathrm{kill}(y)\}(x=y=z=none)[/math]

It tells that all references to an object x obtain the value none. No dangling reference error appears. The cost of the kill operation is fixed, independent of how many variables share the object x as common value. For more information see safe dealocation of objects.

How to determine the inherited class

One program may contain many classes of the same name. This is true of any programming language that allow to nest one class in another. Now, let us consider the inheritance relation between classes.

Suppose that a class B inherits (i.e. extends) the class A. Which of possibly many classes A we should identify as a base class?

This question is a fundamental one for the definition of semantics. Consider the following example.


There are 4 languages which admit both nesting of modules (i.e. block structure ) and inheritance:

  • Simula67
  • Loglan'82
  • BETA
  • Java

Each language gives another definition of the base class. We shall mention ...

Is it possible to keep the Dijkstra's mechanism of Display Vector ?

Alien call

Part II Axiomatic definitions of sublanguages of Loglan'82

Here we shall present an increasing sequence of sublanguages [math]\mathcal{L}\subset[/math]Li of Loglan'82. For each language we shall present its grammar and a semantics as defined by some axioms and inference rules.

Program

Program in Loglan'82 has the following structure


program <name>;

<declarations>

begin

<instructions>

end

Declarations of variables. Assignment instructions

Example

program P2 ;

var x,y: integer;

begin

y:=74;
x:= y+ 8;

end

Grammar
Context free grammar

Well formed expressions

Axiom

[math]{x:=\tau}( \alpha ) \Leftrightarrow \alpha(x/\tau)[/math]