Axiomatic definitions of sublanguages of Loglan'82: Różnice pomiędzy wersjami
(Utworzono nową stronę "On these pages we shall attempt to develop a sequence of algorithmic theories that correspond to a sequence of sublanguages of of Loglan'82 language.") |
|||
Linia 1: | Linia 1: | ||
On these pages we shall attempt to develop a sequence of algorithmic theories that correspond to a sequence of sublanguages of of Loglan'82 language. | On these pages we shall attempt to develop a sequence of algorithmic theories that correspond to a sequence of sublanguages of of Loglan'82 language. | ||
+ | |||
+ | |||
+ | Part II Axiomatic definitions of sublanguages of Loglan'82 | ||
+ | Here we shall present an increasing sequence of sublanguages <math>\mathcal{L}_0\subset\mathcal{L}_1\subset\mathcal{L}_2\subset \mathcal{L}_3\subset\mathcal{L}_4\subset \dots</math>Loglan'82. For each language <math>\mathcal{L}_i</math> we shall present its grammar and some axioms and inference rules that define its semantics. | ||
+ | === Program === | ||
+ | Program in Loglan'82 has the following structure<br /> | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |+ Program | ||
+ | !definiendum!! definiens | ||
+ | |- | ||
+ | | style="background-color:palegreen" | ''program'' | ||
+ | | style="background-color:GoldenRod" | '''program''' <''name''>;<br /> | ||
+ | |||
+ | :<''declarations''><br /> | ||
+ | |||
+ | '''begin'''<br /> | ||
+ | |||
+ | :<''instructions''><br /> | ||
+ | |||
+ | '''end''' | ||
+ | |||
+ | |} | ||
+ | |||
+ | where ''name'' is any identifier, i.e. a finite sequence of letters and digits beginning with a letter. | ||
+ | |||
+ | The ''declarations'' and ''instructions'' are finite sequences of declarations and instructions respectively, empty squence included. | ||
+ | |||
+ | This allow us to define the first sublanguage <math>\mathcal{L}_0</math> of Loglan'82. | ||
+ | |||
+ | <math>\mathcal{L}_0 \stackrel{df}{=}\{p\in \mathcal{A}^*: p=\textbf{program}\ \textit{id}; \textbf{begin end} \}</math> | ||
+ | |||
+ | Programs of the language <math>\mathcal{L}_0</math> are empty programs, they posses just a name. Their list of instructions as well as list of declarations are empty. The effect of execution of such program is ''do nothing''. | ||
+ | |||
+ | Now we shall define a new language <math>\mathcal{L}_{0.1}</math>. First, we say that any expression of the form:<br /> | ||
+ | writeln; <br /> | ||
+ | write(''integer''); <br /> | ||
+ | write("here your text"); <br /> | ||
+ | is an output instruction. | ||
+ | |||
+ | <math>\mathcal{L}_{0.1} \stackrel{df}{=}\{p\in \mathcal{A}^*: p=\textbf{program} \textit{ id}; \textbf{begin} <\textit{output instructions}> \textbf{end} \}</math> | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |+ style="text-align:left" | '''Example 0.1''' <br /> | ||
+ | |- | ||
+ | | program print; <br /> | ||
+ | begin <br /> | ||
+ | :write("hallo world!"); writeln; <br /> | ||
+ | :write("Today is: May"); write(22); write(2014); writeln <br /> | ||
+ | end <br/> | ||
+ | |} | ||
+ | |||
+ | === Declarations of variables. Assignment instructions === | ||
+ | '''Example'''<br /> | ||
+ | |||
+ | '''program''' P2 ;<br /> | ||
+ | :'''var''' x,y: integer;<br /> | ||
+ | '''begin'''<br /> | ||
+ | :y:=74;<br /> | ||
+ | :x:= y+ 8;<br /> | ||
+ | '''end'''<br /> | ||
+ | |||
+ | '''Grammar'''<br /> | ||
+ | Context free grammar | ||
+ | |||
+ | Well formed expressions | ||
+ | |||
+ | '''Axiom'''<br /> | ||
+ | |||
+ | <math>\{x:=\tau\}( \alpha ) \Leftrightarrow \alpha(x/\tau)</math> |
Wersja z 12:48, 25 lis 2014
On these pages we shall attempt to develop a sequence of algorithmic theories that correspond to a sequence of sublanguages of of Loglan'82 language.
Part II Axiomatic definitions of sublanguages of Loglan'82
Here we shall present an increasing sequence of sublanguages [math]\mathcal{L}_0\subset\mathcal{L}_1\subset\mathcal{L}_2\subset \mathcal{L}_3\subset\mathcal{L}_4\subset \dots[/math]Loglan'82. For each language [math]\mathcal{L}_i[/math] we shall present its grammar and some axioms and inference rules that define its semantics.
Program
Program in Loglan'82 has the following structure
definiendum | definiens |
---|---|
program | program <name>;
begin
end |
where name is any identifier, i.e. a finite sequence of letters and digits beginning with a letter.
The declarations and instructions are finite sequences of declarations and instructions respectively, empty squence included.
This allow us to define the first sublanguage [math]\mathcal{L}_0[/math] of Loglan'82.
[math]\mathcal{L}_0 \stackrel{df}{=}\{p\in \mathcal{A}^*: p=\textbf{program}\ \textit{id}; \textbf{begin end} \}[/math]
Programs of the language [math]\mathcal{L}_0[/math] are empty programs, they posses just a name. Their list of instructions as well as list of declarations are empty. The effect of execution of such program is do nothing.
Now we shall define a new language [math]\mathcal{L}_{0.1}[/math]. First, we say that any expression of the form:
writeln;
write(integer);
write("here your text");
is an output instruction.
[math]\mathcal{L}_{0.1} \stackrel{df}{=}\{p\in \mathcal{A}^*: p=\textbf{program} \textit{ id}; \textbf{begin} \lt\textit{output instructions}\gt \textbf{end} \}[/math]
program print; begin
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]