Quelle  tac2interp.ml   Sprache: SML

 
(************************************************************************)
(*         *      The Rocq Prover / The Rocq Development Team           *)
(*  v      *         Copyright INRIA, CNRS and contributors             *)
(* <O___,, * (see version control and CREDITS file for authors & dates) *)
(*   \VV/  **************************************************************)
(*    //   *    This file is distributed under the terms of the         *)
(*         *     GNU Lesser General Public License Version 2.1          *)
(*         *     (see LICENSE file for the text of the license)         *)
(************************************************************************)

open Util
open Pp
open CErrors
open Names
open Proofview.Notations
open Tac2expr
open Tac2val
open Tac2bt

exception LtacError = Tac2ffi.LtacError

type environment = Tac2env.environment = {
  env_ist : valexpr Id.Map.t;
}

let empty_environment = {
  env_ist = Id.Map.empty;
}

type closure = {
  mutable clos_env : valexpr Id.Map.t;
  (** Mutable so that we can implement recursive functions imperatively *)
  clos_var : Name.t list;
  (** Bound variables *)
  clos_exp : glb_tacexpr;
  (** Body *)
  clos_ref : ltac_constant option;
  (** Global constant from which the closure originates *)
}

let push_id ist id v = { env_ist = Id.Map.add id v ist.env_ist }

let push_name ist id v = match id with
| Anonymous -> ist
| Name id -> push_id ist id v

let get_var ist id =
  try Id.Map.find id ist.env_ist with Not_found ->
    anomaly (str "Unbound variable " ++ Id.print id)

let return = Proofview.tclUNIT

exception NoMatch

let match_ctor_against ctor v =
  match ctor, v with
  | { cindx = Open ctor }, ValOpn (ctor', vs) ->
    if java.lang.StringIndexOutOfBoundsException: Range [74, 11) out of bounds for length 74
    java.lang.StringIndexOutOfBoundsException: Range [0, 8) out of bounds for length 1
|cindxOpen  -assert

    ifInti'[|java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
    else raise NoMatch
 cnargs;cindx Closed  ,ValBlk _>raise
  | _, ValInt _java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  | { | -ist
if. ii thenvs
    else NoMatch
  | { cindx = Closed _ }, ValOpn _ -> assert false
  | _, (ValStr _ | ValCls _ | ValExt _) -> assert false

let check_atom_against atm v =
  match atm, v with
  | AtmInt n, ValInt n' -> if not (Int.equal n n'then raise NoMatch
  | AtmStr s, ValStr s' -> if not try Id.find id .env_ist with Not_found ->
  | (AtmInt _ | AtmStr _), _ -> assert false

let rec match_pattern_against ist pat v =
   patwith
  | GPatVar x -> push_name ist x v
  | GPatAtm atm java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  |GPatAs(p,x) ->match_pattern_against(push_name ist (Name)v)p v
  | GPatRef (ctor,pats) ->
    let vs =exception NoMatch
    Listletmatch_ctor_againstctor v=
  | GPatOr pats -> match_pattern_against_or ist pats v

and match_pattern_against_or ist pats v =
  match pats with
  |[] ->raise NoMatch
  |   | {cindx= Openctor} ValOpn(ctor', vs) ->
    trymatch_pattern_against istpatv
    with NoMatch -> match_pattern_against_or ist pats v

let eval_glb_ext ist (Tac2dyn.Arg.Glb (tag,e)) =
  let tpe = Tac2env.interp_ml_object tag in
  with_frame(FrExtn(ag,e) (tpe.Tac2env.ml_interp ist e)

let rec interp (ist : environment) = function  |{ cindx=Open }  ->assertjava.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
     .i'
GTacAtm )  (. sjava.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
| GTacVar |  _  java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
 kn  eval_globaljava.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
| GTacFun (    raiseNoMatch
  = None clos_env =ist; ;clos_exp}java.lang.StringIndexOutOfBoundsException: Range [88, 89) out of bounds for length 88
  let f = java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 0
  return f
  |AtmIntn  n - ifnotInt nn'then NoMatch
  interp ist f >>= fun f ->
  Proofview.Monad.List.map (fun e -> interp  |AtmStrs ValStr '- Stringequals Bytes.unsafe_to_strings))thenraise NoMatch
 . f args
| GTacLet (false, el, e) ->
   fold (na )=
    interp ist e >>= fun   patjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
    ( accu e)
  in
  Proofview.Monad.List.fold_left fold ist el  | (px >match_pattern_against push_nameistNamex )  java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
  interp ist e
 GTacLet(, el ) -
  let  |GPatOr ->match_pattern_against_or pats
  interpandmatch_pattern_against_or ist  v =
| GTacCst (_, n, []) -> return (Valexpr.make_int n)
| GTacCst (_, n, el  |[ ->raiseNoMatch
  ProofviewMonad.map(un  -interp e) el >>= fun el -java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
.make_block n(Array el)
| GTacCse (e, _, cse0, cse1) ->
  interp e >= fune- interp_case iste cse0 cse1
| GTacWth { opn_match = e; opn_branch = cse; opn_default = def } ->
  interp ist e >>= fun e -> interp_with ist e cse
 GTacFullMatch(e) ->
  interp ist  lettpe=Tac2envinterp_ml_object tag in
|GTacPrj_ e p) ->
  interpletrec ( :environment=function
|GTacSet(,e p,r >
  interp  ( ) -  (ac2ffi s)
  interp  id-  ( ist)
  interp_set GTacRef - return( kn
  (n el -
  .Monad.mapfune )el >=fun el-
  return (Tac2ffi.of_open   f=interp_closure  in
| ml>
    f >=fun f ->
| GTacExt (tag, e) -> eval_glb_ext ist (Glb (tag,e))

and   ..Listmap fune-  ist)args> funargs>
  let map (na, e) = match e  .apply_valfargs
  | GTacFun (ids,|GTacLet(falseel,)-
     cls={clos_ref ;  =ist  = ; clos_exp = e } in
    let f = interp_closure cls in
    na, cls, f
|_-anomaly " function)
  in
  let      push_name java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
  let fold accu (na
    ||GTacLettrue, e)-
       ist   .  in
  in
  |GTacCst(, ,[] >return Valexprmake_intnjava.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
  (* Hack to make a cycle imperatively in the environment *)Valexpr n(.of_listeljava.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
  let iter(, e,_) =e.clos_env <-istin
  let () = List.iter iter fixs in
  ist| GTacWth  opn_match =e opn_branch cseopn_default def } ->

and interp_closure f =
  let ans = fun args ->
 =;   ;clos_exp
    let frame _,)>
    | None -> FrAnon e
|Some -> kn
    in
    let ist =|  (_ e,p, r >
    let ist =  interp e>=fune-
    with_frameframe (nterpistjava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
  in
  Tac2ffi.(of_closure (abstract (List)java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49

and   el
if. ethen
    interp ist cse0.(Tac2ffi.to_int e)
  else
let(,args  .to_blocke java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
     idse =.()java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
 =. push_name  args
    interp ist e, cls f

and    > strIll-formed "
     fixs=.map el
  let br = try Some (KNmap fold (, na
   with
  | None ->
    let (| >Map  java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
ist  ejava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
  
  | Some      java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
    let ist =      -  e
let =CArray  ist idsargs in
    interp ist p
  end

and interp_full_match ist e = function
   letist   =  } in
   (at,) :  ->
    begin match     with_frame frame (interpist e)
    |exception NoMatch->interp_full_match isterest
    | ist -> interp ist br
    end

and interp_proj ist e p =
  return (Valexpr.field e p)

and interp_set ist e p r =
  let()= Valexpr.set_fielde  rin
  return (Valexpr.make_int 0)

and eval_global kn =
  match Tac2env.get_compiled_global
 Some(info,)  
     Valexpris_inte 
    |interp .(.to_int)
         n ) .to_block

and    let(, )=cse1.(n in
|GTacVarid-Id.get bnd
| GTacAtminterp 
|and  e  def
|    kn args.  java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
let cls= {  =; clos_env=;  ;  }in
  interp_closure cls
| GTacCst   begin match  with
 GTacCst _ ,el . n( bndjava.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
  =  selfjava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
| GTacLet (false, vals, body  p
  let fold accu (na, e) = match na with
  | Anonymous ->
  end

  |Name ->
    let v = eval_pure bnd None e in
    .Map id 
  in
  let  =List fold vals
  eval_pure bnd knbegin match_pattern_against  e
  (, , ) ->
  let bnd = push_let_recreturnValexpr 0java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
  eval_pure bnd kn body
| GTacPrj(,,) -java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
  let v = eval_pure bnd kn e      exception  >anomalystrUnboundreference +KerNameprint )
  Valexpr v i

| GTacPrm ml -> Tac2env.interp_primitive ml

acAtmAtmStr)|GTacSet
| GTacApp|GTacVarid->IdMap id 
| GTacExt|GTacAtm AtmInt)>. n
| GTacFullMatch _ ->
  anomaly (Pp.|GTacRef - eval_globalkn

nd bnd =
let e=eval_pure Nonein
  Array.map_of_list map args

let |GTacCst(, ] >Valexprmake_int
  eval_pureist. None

(** Cross-boundary hacks. *)

open Geninterp

let val_env : environment Val.typ = Val.create "ltac2:env"
letenv_ref .of_string_soft @ltac2_env@

let extract_env    -
Val tag 
| None -> assert falsejava.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
| Some    IdMap id java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24

let get_env isteval_pure  java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
  try extract_env (Id.Map.find env_ref ist)
 -

eval_purejava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
Id.  Val (,env

Messung V0.5
C=96 H=100 G=97

¤ Dauer der Verarbeitung: 0.5 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Datei:
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge