Project

General

Profile

Revision b38ffff3 src/corelang.mli

View differences:

src/corelang.mli
1
(* ----------------------------------------------------------------------------
2
 * SchedMCore - A MultiCore Scheduling Framework
3
 * Copyright (C) 2009-2011, ONERA, Toulouse, FRANCE - LIFL, Lille, FRANCE
4
 *
5
 * This file is part of Prelude
6
 *
7
 * Prelude is free software; you can redistribute it and/or
8
 * modify it under the terms of the GNU Lesser General Public License
9
 * as published by the Free Software Foundation ; either version 2 of
10
 * the License, or (at your option) any later version.
11
 *
12
 * Prelude is distributed in the hope that it will be useful, but
13
 * WITHOUT ANY WARRANTY ; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
 * Lesser General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Lesser General Public
18
 * License along with this program ; if not, write to the Free Software
19
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20
 * USA
21
 *---------------------------------------------------------------------------- *)
1
(********************************************************************)
2
(*                                                                  *)
3
(*  The LustreC compiler toolset   /  The LustreC Development Team  *)
4
(*  Copyright 2012 -    --   ONERA - CNRS - INPT                    *)
5
(*                                                                  *)
6
(*  LustreC is free software, distributed WITHOUT ANY WARRANTY      *)
7
(*  under the terms of the GNU Lesser General Public License        *)
8
(*  version 2.1.                                                    *)
9
(*                                                                  *)
10
(********************************************************************)
22 11

  
23
open LustreSpec
24
(*
25
(** The core language and its ast. *)
26
type ident = Utils.ident
27
type label = Utils.ident
28
type rat = Utils.rat
29
type tag = Utils.tag
30

  
31
type constant =
32
  | Const_int of int
33
  | Const_real of string
34
  | Const_float of float
35
  | Const_array of constant list
36
  | Const_tag  of label
37
  | Const_struct of (label * constant) list
38

  
39
val dummy_type_dec: type_dec
40

  
41
type type_dec = LustreSpec.type_dec
42

  
43
type clock_dec = LustreSpec.clock_dec
44
val dummy_clock_dec: clock_dec
45

  
46
type var_decl = LustreSpec.var_decl
47

  
48
type expr =
49
  {expr_tag: tag; (* Unique identifier *)
50
   expr_desc: expr_desc;
51
   mutable expr_type: Types.type_expr;
52
   mutable expr_clock: Clocks.clock_expr;
53
   mutable expr_delay: Delay.delay_expr; (* Used for the initialisation check *)
54
   mutable expr_annot: LustreSpec.expr_annot option; (* Spec *)
55
   expr_loc: Location.t}
56 12

  
57
and expr_desc =
58
| Expr_const of constant
59
| Expr_ident of ident
60
| Expr_tuple of expr list
61
| Expr_ite   of expr * expr * expr
62
| Expr_arrow of expr * expr
63
| Expr_fby of expr * expr
64
(*
65
| Expr_struct of (label * expr) list
66
| Expr_field of expr * label
67
| Expr_update of expr * (label * expr)
68
*)
69
| Expr_array of expr list
70
| Expr_access of expr * Dimension.dim_expr (* acces(e,i) is the i-th element 
71
					      of array epxression e *)
72
| Expr_power of expr * Dimension.dim_expr (* power(e,n) is the array of 
73
					     size n filled with expression e *)
74
| Expr_pre of expr
75
| Expr_when of expr * ident * label
76
| Expr_merge of ident * (label * expr) list
77
| Expr_appl of call_t
78
| Expr_uclock of expr * int
79
| Expr_dclock of expr * int
80
| Expr_phclock of expr * rat
81
and call_t = ident * expr * (ident * label) option (* The third part denotes the reseting clock label and value *)
82

  
83
type eq =
84
    {eq_lhs: ident list;
85
     eq_rhs: expr;
86
     eq_loc: Location.t}
87

  
88
type assert_t = 
89
    {
90
      assert_expr: expr * eq list;
91
      assert_loc: Location.t
92
    } 
93

  
94
type node_desc =
95
    {node_id: ident;
96
     mutable node_type: Types.type_expr;
97
     mutable node_clock: Clocks.clock_expr;
98
     node_inputs: var_decl list;
99
     node_outputs: var_decl list;
100
     node_locals: var_decl list;
101
     mutable node_gencalls: expr list;
102
     mutable node_checks: Dimension.dim_expr list;
103
     node_asserts: assert_t list; 
104
     node_eqs: eq list;
105
     mutable node_dec_stateless: bool;
106
     mutable node_stateless: bool option;
107
     node_spec: LustreSpec.node_annot option;
108
     node_annot: LustreSpec.expr_annot option;}
109

  
110
type imported_node_desc =
111
    {nodei_id: ident;
112
     mutable nodei_type: Types.type_expr;
113
     mutable nodei_clock: Clocks.clock_expr;
114
     nodei_inputs: var_decl list;
115
     nodei_outputs: var_decl list;
116
     nodei_stateless: bool;
117
     nodei_spec: LustreSpec.node_annot option;
118
     nodei_prototype: string option;
119
     nodei_in_lib: string option;
120
}
121
(*
122
type imported_fun_desc =
123
    {fun_id: ident;
124
     mutable fun_type: Types.type_expr;
125
     fun_inputs: var_decl list;
126
     fun_outputs: var_decl list;
127
     fun_spec: LustreSpec.node_annot option;}
128
*)
129
type const_desc = 
130
    {const_id: ident; 
131
     const_loc: Location.t; 
132
     const_value: constant;      
133
     mutable const_type: Types.type_expr;
134
    }
135
(* type sensor_desc = *)
136
(*     {sensor_id: ident; *)
137
(*      sensor_wcet: int} *)
138

  
139
(* type actuator_desc = *)
140
(*     {actuator_id: ident; *)
141
(*      actuator_wcet: int} *)
142

  
143
type top_decl_desc =
144
  | Node of node_desc
145
  | Consts of const_desc list
146
  | ImportedNode of imported_node_desc
147
  (* | ImportedFun of imported_fun_desc *)
148
  (* | SensorDecl of sensor_desc *)
149
  (* | ActuatorDecl of actuator_desc *)
150
  | Open of bool * string
151

  
152
type top_decl =
153
    {top_decl_desc: top_decl_desc;
154
     top_decl_loc: Location.t}
155

  
156
type program = top_decl list
13
open LustreSpec
157 14

  
158
type error =
159
    Main_not_found
160
  | Main_wrong_kind
161
  | No_main_specified
162
  | Unbound_symbol of ident
163
  | Already_bound_symbol of ident
164
*)
165 15
exception Error of Location.t * error
166 16

  
167 17
val dummy_type_dec: type_dec

Also available in: Unified diff