Project

General

Profile

Download (1.55 KB) Statistics
| Branch: | Tag: | Revision:
1
open Env
2
open Basetypes
3
open Datatype
4
(* open Interpreter *)
5
open Parser_json
6
(* open Transformer *)
7
open Theta
8
open CPS_ccode_generator
9
open CPS_interpreter
10
open CPS_transformer
11

    
12
module ParseExt =
13
struct
14
  let parse_condition _ = Condition.tru
15
  let parse_action    _ = Action.nil
16
  let parse_event json  = Some Yojson.Basic.(json |> to_string)
17
end
18

    
19
module Parse = Parser (ParseExt)
20

    
21
module Prog =
22
struct
23
  let json                       = Yojson.Basic.from_file "GPCA_Alarm_Alarm_SFIR_pp.json"
24
  let Program (init, defs, vars) = Parse.parse_prog json
25
  let prog                       = Parse.parse_prog json
26
  (* let user_vars                  = Parse.parse_variables json *)
27
  (*let _ = Format.printf "Model definitions@.%a@.####" Simulink.pp_src defs; ()*)
28
end
29

    
30
module Transformer =
31
  (* CPS_ccode_generator.LustrePrinter (Program) *)
32
  CodeGenerator
33
  (* CPS_ccode_generator.Evaluator *)
34

    
35
module Interp = Interpreter (Transformer)
36

    
37
module KenvTheta = KenvTheta (Transformer)
38

    
39
module Modularity : KenvTheta.ModularType =
40
struct
41
  let modular : type b. (path_t, b, bool) tag_t -> path_t -> b =
42
    fun tag ->
43
    match tag with
44
    | E -> (fun p p' f -> true)
45
    | D -> (fun p      -> true)
46
    | X -> (fun p f    -> true)
47
end
48

    
49
module Tables = KenvTheta.MemoThetaTables ()
50

    
51
module Thetaify = KenvTheta.ModularThetaify (Tables) (Modularity)
52

    
53
module EvalProg = Interp.Evaluation (Thetaify) (Prog)
54

    
55
let main ()  =
56
  begin
57
    SF.pp_prog Format.std_formatter (Parse.parse_prog Prog.json);
58
    (* SF.pp_vars Format.std_formatter (Parse.parse_variables Prog.json); *)
59
  end
60

    
61
let _ = main ()
(3-3/4)