source: extracted/fresh.ml @ 2601

Last change on this file since 2601 was 2601, checked in by sacerdot, 8 years ago

Extraction to ocaml is now working, with a couple of bugs left.
One limitation is that it is not possible to have two files with the
same name in different directories. Therefore this commit renames files
to avoid this situation.

The extracted directory contains:

  1. a snapshot of the .ml(i) files extracted from CerCo? by running ocamlc.opt -extract_ocaml compiler.ma The files have been patched by hand to implement all strings and fix the bugs.
  2. a file PROBLEMS that describes the remaining problems, i.e. bugs and axioms to be implemented

To obtain the compiler, run ocamlbuild compiler.byte.
At the moment it fails because of the three remaining axioms.

File size: 2.1 KB
Line 
1open Preamble
2
3open CostLabel
4
5open Proper
6
7open PositiveMap
8
9open Deqsets
10
11open PreIdentifiers
12
13open Errors
14
15open Extralib
16
17open Setoids
18
19open Monad
20
21open Option
22
23open Lists
24
25open Positive
26
27open Identifiers
28
29open Coqlib
30
31open Floats
32
33open Arithmetic
34
35open Char
36
37open String
38
39open Vector
40
41open Div_and_mod
42
43open Jmeq
44
45open Russell
46
47open List
48
49open Util
50
51open FoldStuff
52
53open BitVector
54
55open Extranat
56
57open Bool
58
59open Relations
60
61open Nat
62
63open Integers
64
65open Hints_declaration
66
67open Core_notation
68
69open Pts
70
71open Logic
72
73open Types
74
75open AST
76
77open Csyntax
78
79(** val max_id : AST.ident -> AST.ident -> AST.ident **)
80let max_id a b =
81  let a0 = a in let b0 = b in Positive.max0 a0 b0
82
83(** val max_id_of_env :
84    (AST.ident, Csyntax.type0) Types.prod List.list -> AST.ident **)
85let max_id_of_env =
86  List.foldr (fun it id -> max_id it.Types.fst id) Positive.One
87
88(** val max_id_of_fn : Csyntax.function0 -> AST.ident **)
89let max_id_of_fn f =
90  max_id_of_env (List.append f.Csyntax.fn_params f.Csyntax.fn_vars)
91
92(** val max_id_of_fundef : Csyntax.clight_fundef -> AST.ident **)
93let max_id_of_fundef = function
94| Csyntax.CL_Internal f0 -> max_id_of_fn f0
95| Csyntax.CL_External (id, x, x0) -> id
96
97(** val max_id_of_functs :
98    (AST.ident, Csyntax.clight_fundef) Types.prod List.list -> AST.ident **)
99let max_id_of_functs =
100  List.foldr (fun idf id ->
101    max_id (max_id idf.Types.fst (max_id_of_fundef idf.Types.snd)) id)
102    Positive.One
103
104(** val max_id_of_globvars :
105    ((AST.ident, AST.region) Types.prod, (AST.init_data List.list,
106    Csyntax.type0) Types.prod) Types.prod List.list -> AST.ident **)
107let max_id_of_globvars =
108  List.foldr (fun it id -> max_id it.Types.fst.Types.fst id) Positive.One
109
110(** val max_id_of_program : Csyntax.clight_program -> AST.ident **)
111let max_id_of_program p =
112  max_id (max_id (max_id_of_functs p.AST.prog_funct) p.AST.prog_main)
113    (max_id_of_globvars p.AST.prog_vars)
114
115(** val universe_of_max : AST.ident -> Identifiers.universe **)
116let universe_of_max mx =
117  let i = mx in let next = Positive.succ i in next
118
119(** val universe_for_program :
120    Csyntax.clight_program -> Identifiers.universe **)
121let universe_for_program p =
122  universe_of_max (max_id_of_program p)
123
Note: See TracBrowser for help on using the repository browser.