let parse c =
    let lb = from_channel c in
    try
      Promelaparser.promela token lb
    with 
        Parsing.Parse_error 
      | Invalid_argument _ -> 
          let (a,b)=(loc lb) in 
                   Aorai_option.error "Syntax error (l%d c%d -> l%dc%d)" a.pos_lnum (a.pos_cnum-a.pos_bol) b.pos_lnum (b.pos_cnum-b.pos_bol);
(*            Format.print_string "Syntax error (" ;   *)
(*            Format.print_string "l" ;                *)
(*            Format.print_int a.pos_lnum ;            *)
(*            Format.print_string "c" ;                *)
(*            Format.print_int (a.pos_cnum-a.pos_bol) ;*)
(*            Format.print_string " -> l" ;            *)
(*            Format.print_int b.pos_lnum ;            *)
(*            Format.print_string "c" ;                *)
(*            Format.print_int (b.pos_cnum-b.pos_bol) ;*)
(*            Format.print_string ")\n" ;              *)
            raise_located (loc lb) "Syntax error"