]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/mathql_interpreter/mqint.ml
new semantics for relation and attribute
[helm.git] / helm / ocaml / mathql_interpreter / mqint.ml
index 053e20c74bb009fa5ecbef498a7a3f12cb4bfcfb..a0c56e3848835e0cc8a65212d8227ae87e28008c 100644 (file)
@@ -35,9 +35,9 @@ open Eval;;
 open Utility;;
 open Dbconn;;
 open Pattern;;
-open Union;;
+open Union;;*)
 open Intersect;;
-open Diff;;
+(*open Diff;;
 open Sortedby;;
 open Use;;
 open Select;;
@@ -265,6 +265,8 @@ type rvar_context = (MathQL.rvar * MathQL.resource) list
 
 type group_context = (MathQL.rvar * MathQL.attribute_group) list
 
+type vvar_context = (MathQL.vvar * MathQL.value) list
+
 
 let svars = ref [] (* contesto delle svar *)
 
@@ -272,13 +274,14 @@ let rvars = ref [] (* contesto delle rvar *)
 
 let groups = ref [] (* contesto dei gruppi *)
 
+let vvars = ref [] (* contesto delle vvar introdotte con let-in *)
 
-(* valuta una MathQL.set_exp e ritorna un MathQL.resource_set *)
 
 let rec exec_set_exp = function 
-   | MathQL.Ref x -> []
-
-
+   | MathQL.Ref vexp -> List.map (fun s -> (s,[])) (exec_val_exp vexp)
+   | MathQL.Intersect sexp1 sexp2 -> intersect_ex (exec_set_exp sexp1) (exec_set_exp sexp2)    
+   | _ -> assert false
+   
 (* valuta una MathQL.boole_exp e ritorna un boole *)
 
 and exec_boole_exp = function
@@ -286,17 +289,19 @@ and exec_boole_exp = function
    | MathQL.True       -> true
    | MathQL.Not x      -> not (exec_boole_exp x)
    | MathQL.And (x, y) -> (exec_boole_exp x) && (exec_boole_exp y)
-   | MathQL.Or (x, y)  -> (exec_boole_exp x) || (exec_boole_exp y)
-
+   | MathQL.Or (x, y)  -> (exec_boole_exp x) || (exec_boole_exp y)   
+   | _ -> assert false
 
 (* valuta una MathQL.val_exp e ritorna un MathQL.value *)
 
 and exec_val_exp = function
-   | MathQL.Const l -> []
-
+   | MathQL.Const x -> x
+   | _ -> assert false
 
 (* valuta una MathQL.set_exp nel contesto vuoto e ritorna un MathQL.resource_set *)
 
+(* valuta una MathQL.set_exp e ritorna un MathQL.resource_set *)
 let execute x =
-   svars := []; rvars := []; groups := [];
+   svars := []; rvars := []; groups := []; vvars := [];
    exec_set_exp x
+