Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] What does this mean?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: skaller <skaller@u...>
Subject: [Caml-list] What does this mean?
Can someone explain what this means .. 

Invalid_argument("equal: abstract value")

The code is below. I am fairly sure the problem
occurs in 'assoc' trying to compare two terms
for equality.

This piece of code unravels a Felix expression term
into a three-address-code, the equality comparison
is used to eliminate common subexpressions.

let unravel syms e =
  let sube = ref [] in
  let get e = 
    try assoc e !sube 
    with Not_found ->
      let n = !(syms.counter) in incr (syms.counter);
      let name = "_tmp" ^ si n in
      sube := (e,name) :: !sube;
      name
  in
  let refer ((_,t) as e) = 
    `BEXPR_expr (get e,t),t
  in
  let idt t = t in
  let e' = 
    let rec aux e = 
      match e with
      | `BEXPR_apply ((`BEXPR_name _,_) as f, b),t
      | `BEXPR_apply ((`BEXPR_closure _,_) as f, b),t ->
        `BEXPR_apply (f, aux b),t
      | `BEXPR_apply (f,b),t -> `BEXPR_apply(aux f, aux b),t
      | `BEXPR_tuple ls,t -> `BEXPR_tuple (map aux ls),t
      | (`BEXPR_name _,t) as x -> x
      | x -> refer x
    in 
      aux e
 in !sube,e

-- 
John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net



-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners