http://jeanjacqueslevy.nethttp://w3.edu.polytechnique.fr/informatique
|
|||||||||||
|
|
||||||||||
|
|
||||||||||
|
|||||||||||
|
|||||||||||
|
|||||||||||
| t,t' | ::= | " a1,a2, ··· an.t | (n ³ 0) schéma de type | |
| t,t' | ::= | a | variable de type | |
| | | int | les entiers naturels N | ||
| | | t ® t' | les fonctions de T dans T' |
| FV(a) = {a} | FV(" a1,a2, ··· an.t) = FV(t) - {a1,a2, ··· an } | |
| FV(int) = Ø | FV(t® t') = FV(t) È FV(t') | |
| FV(Ø) = Ø | FV(r, x:t) = FV(r) È FV(t) |
| t £ " a1,a2, ··· an.t' |
| ss'il existe t1,t2,··· tn tels que t = t' [a1 \ t1, a2 \ t2, ··· an \ tn] |
| W(r + {x : t}, x) = (t, identite) ( t instance de t par des variables fraiches) | ||||||||
| W(r, l x.M) = (f(a) ® t', f) où | ||||||||
| W(r + {x : a}, M) = (t', f) (a variable fraiche) | ||||||||
| W(r, MN) = (s(a), s ° f' ° f) où | ||||||||
| W(r, M) = (t, f) W(f(r), N) = (t', f') s = mgu(f'(t) = t' ® a) | ||||||||
| (a variable fraiche) Retourner échec si s n'existe pas. | ||||||||
| W(r, let x=M in N) = (t', f' ° f) où | ||||||||
| W(r,M) = (t, f) W(f(r) + {x : Gen(t,f(r))}, N) = (t', f') | ||||||||
|
||||||||
| W(r, M Ä N) = (int, s' ° f' ° s ° f) où | ||||||||
| W(r,M) = (t,f) s = mgu(t = int) | ||||||||
| W((s ° f)(r),N) = (t',f') s'= mgu(t' = int) | ||||||||
| Retourner échec si s ou s' n'existe pas. | ||||||||
| W(Ø,l x.x+x) = (int ® int, [a\int]) | ||||||
|
|
||||||||||||||||||||
|
| M, N, P | ::= | ... | voir cours précédents | |
| | | ref M | création | ||
| | | !M | valeur | ||
| | | M := N | modification de valeur | ||
| | | () | valeur vide |
| V,V' | ::= |
|
constante entière | ||||
| | | l x.M | abstraction | |||||
| | | location | ||||||
| | | () | valeur vide |
| s | ::= | [1 = V1, 2 = V2, ..., n = Vn] | (i tous distincts) | |
| domain(s) = {1, 2, ... n} | ||||
| b | á (l x.M) V, sñ ® á M [x \ V], sñ | ||||||||||||||||
| op |
|
||||||||||||||||
| cond1 |
|
||||||||||||||||
| cond2 |
|
(n ¹ 0) | |||||||||||||||
| µ | á µ x.M, sñ ® á M [x \ µ x. M], sñ | ||||||||||||||||
|
á let x = V in N, sñ ® á N [x \ V], sñ | ||||||||||||||||
| alloc | á ref V, sñ ® á , s + [=V]ñ | (Ïdomain(s)) | |||||||||||||||
| deref | á !, sñ ® á s(), sñ | ||||||||||||||||
| assign | á := V, sñ ® á (), s[\ V]ñ |
|
||||||||||||||||
|
||||||||||||||||
|
||||||||||||||||
|
||||||||||||||||
|
||||||||||||||||
|
||||||||||||||||
|
| 0 si m £ n | |
| 1 si m > n |
| á M, sñ ® á V, s'ñ |
| á M;N, sñ ®* á N, s'ñ |
| M, N, P | ::= | ... | ||
| | | [| M1; M2; ...; Mn |] | création | ||
| | | M[N] | valeur d'un élément | ||
| | | M[N] ¬ P | modification de valeur | ||
| | | length M | taille d'un tableau |
| alloct | á [| V1; V2; ... Vn |], sñ ® á , s + [ =[| V1; V2; ... Vn |] ]ñ (Ïdomain(s)) | |||||||||||||
| accès |
|
|||||||||||||
| assign |
|
|||||||||||||
| length |
|
| () | : | unit | ||
| ref | : | "a.a®ref(a) | ||
| ! | : | "a.ref(a)®a | ||
| := | : | "a.ref(a)®a®unit |
|
| r | : | "a.ref(list(a)) | ||
| r | : | ref(list(int)) | ||
| r | : | ref(list(int®int)) |
This document was translated from LATEX by HEVEA.