The outline of the Descartes language


1. Similarity with prolog

Since the Descartes language is carried out based on 
the first floor predicate calculus, it has a common 
feature of a prolog language and many. 
Then, the program which Liszt connects should compare 
the Descartes language and a prolog language.

In the Descartes language, it is as follows.

	<append #Z () #Z>;
	<append (#W : #Z1) (#W : #X1) #Y> <append #Z1 #X1 #Y>;

	?<append #x (a b) (c d)>; 


In prolog, it is as follows.

	append(Z, [], Z).
	append( [W | Z1], [W | X1], Y) :- append(Z1, X1, Y).

	? append(X, [a b], [c d]). 



In both of the examples, the list of the 2nd argument and 
the 3rd argument is connected, and a result is returned to 
the 1st argument.

Is a difference understanding?
1) A predicate is bundled with ().
2) A pause of an argument uses a blank.
3) Although period"." is finally placed in prolog, 
 semicolon";" is placed in the Descartes language.
4) A list uses not [] but ().
5) "|" which divides a list is ":" in the Descartes language.
6) Although ":-" is used for a pause of a head part and a body 
 part by prolog, there is nothing in the Descartes language.
7) In the Descartes language, "#" is attached to a variable.

In order to perform the above-mentioned append in the Descartes 
language, it performs in the predicate which attached ? as follows.


	?<append #x (a b) (c d)>;


2. Difference with prolog

Although reference was made about the points of comparison of 
the Descartes language and prolog for the preceding clause, 
difference is described here.

Unlike prolog by which what can be written to a body part is 
restricted to enumeration of a predicate, in the Descartes 
language, what arbitrary lists can be written for differs 
greatly. Execution sequence in a list is performed sequentially 
from the described left.

<example #x> (<e1 #x> (<e2 #x #y> <e3 #y>) <e4 #y> ) <e5 #x>; 

In the above-mentioned example, if example is performed, it 
will perform in order of e1, e2, e3, e4, and e5.

The advantages of this description are meta processing which 
summarizes a sequence of a predicate and is passed to the 
argument of a predicate being performed, or being able to 
use in order to summarize processing for the sign for syntax 
analysis shown below.

It is {} repetition as a sign for syntax analysis [] 
It is also big difference with prolog that the abbreviation 
possibility of, |, or selection can be used.

<example2 #a> <abc> { <def #a> | (<hij> <lkm>) } ![ <nop> ] <end>; 

If def, which of (hij lkm), or the processing in which it 
succeeds is repeated and both do not correspond, 
it escapes from a loop, if example2 is performed in the 
above-mentioned example, abc will be performed, even if nop 
is successful and it goes wrong, it is processed, and finally 
end is performed.


3. comment

There are the following three kinds of comment.
 - From // to the end of the sentence
 - From # to the end of the sentence
 - Range surrounded by /* */

4. Numerical computation

Integrally in a let predicate and a floating point, a letf 
predicate is used for calculation of a number.


	<let #x = 1 + 2>;
	<letf #f = 1.1 + 0.3*(2.3-1.2)>;

The function predicate mentioned later can be used within 
expression.

	<letf #f = ::sys <sin #x1 3.14>+::sys<cos #x2 3.14>>;

let is omissible. The two followings are the same.

	<let #z = #x + #y>;
	<#z = #x + #y>;



5. ֐q

let, letf, f, funcȂǏq̈͊֐qƂĕ]A
֐q̕Ԃ֐l͑1łB
Ԃl̕ϐ́Aϐ"_"gƕ֗łB

	<letf #x = ::sys<sin _ ::sys<cos _ 3.14>>>;

let, letf̒Ŏĝ́AlԂ֐݂̂łB

	<f #x ::sys<car #x1 ::sys<cdr _ (a b c)>>>;

ffunc̕ʖłA܂܂B
܂Af͈ƂăXg邱Ƃ\łAXg
̗vfɊ֐qꂪ܂܂ꍇ́Aׂĕ]ꂽ
֐lƂĕԂ܂B

	<f #x (This is a ::sys <getline _>)>;

(L"::sys"Ƃ̂͌q郉CǔĂяo
\AsysW[getlineq̌ĂяoӖ܂B)

6. Cu

CǔĂяo͈ȉ̂悤Ȍ`ōs܂B

 ::CuW[ <q>
 <unify CuW[ <q>>
 <obj CuW[ <q>>

3ނ̌Ăяo@͓̓ełB


7. IuWFNgw

IuWFNg͈ȉ̂悤Ȍ`Œ`܂B

 :: < IuWFNg
	vO܂inheirt pIuWFNg
 >;

ƂĒAyMÃIuWFNgȉ
܂B

::<bird
	<fly>;
	<walk>;
>;

::<penguin
	<fly>
		<!><false>;
	<swim>;
	inherit bird;
>;

::<hawk
	inherit bird;
>;

IuWFNǧĂяóACǔĂяo@
ƓłBȉĂ݂ĂB

?::bird <swim>;
?::penguin <swim>;
?::bird <walk>;
?::penguin <walk>;
?::bird <fly>;

?::penguin <fly>;
?::penguin <run>;

?::hawk <fly>;
?::hawk <walk>;
?::hawk <swim>;


7. EBNFL@

\͂̂߂EBNFL@g܂B

<O> "c";
<O> "";

<name #x>
	"" ""
	<O> <GETTOKEN #x>
	"ł"
	["B"]
	;

? ::sys<getline _ <name #name>>;

͍łB
result --
(<obj sys <getline ͍łB <name >>>)
-- true

-------------------------------------------------------------
