Commit b413f960 authored by rwyss's avatar rwyss
Browse files

No commit message

No commit message
parents 4a544bba a2b088a3
imported node F(i, j: int) returns (o: int; p: unsigned) wcet 5;
imported node S(i: unsigned) returns (o: int) wcet 5;
imported node F(i, j: int) returns (o, p: int) wcet 5;
imported node S(i: int) returns (o: int) wcet 5;
sensor i wcet 1;
actuator o wcet 1;
......
......@@ -20,7 +20,7 @@
* USA
*---------------------------------------------------------------------------- *)
open Format
open Types
(** The core language and its ast. Every element of the ast contains its
location in the program text. The type and clock of an ast element
is mutable (and initialized to dummy values). This avoids to have to
......@@ -45,7 +45,6 @@ and type_dec_desc =
| Tydec_float
| Tydec_bool
| Tydec_clock
| Tydec_unsigned
type deadline_dec = int option
......
......@@ -40,7 +40,6 @@ and type_dec_desc =
| Tydec_float
| Tydec_bool
| Tydec_clock
| Tydec_unsigned
type deadline_dec = int option
......
......@@ -51,15 +51,12 @@ let keyword_table =
"int", TINT;
"bool", TBOOL;
"float", TFLOAT;
"unsigned", TUNSIGNED;
"real", TREAL;
"clock", TCLOCK;
"rate", RATE;
"due", DUE;
"not", NOT;
"tail", TAIL;
"type", TYPE;
"enum", ENUM
"tail", TAIL
]
(* Update line number for location info *)
......
......@@ -116,6 +116,4 @@ let _ =
| Parse.Syntax_err _ | Lexer.Error _ | Types.Error (_,_) | Clocks.Error (_,_)
| Corelang.Error _ | Task_set.Error _ | Causality_analysis.Cycle _
| Task_graph.Error _ -> ()
| Options.Unknown_tracing tr ->
fprintf err_formatter "@[Unknown tracing option: %s@." tr
| exc -> raise exc
......@@ -55,7 +55,6 @@ type trace_fmt_type =
| LTTngValues
| LTTngInstances
exception Unknown_tracing of string
let trace_fmt () =
match !tracing with
| "values" -> Values
......@@ -63,7 +62,7 @@ let trace_fmt () =
| "lttng-values" -> LTTngValues
| "lttng-instances" -> LTTngInstances
| "no" -> No
| _ -> raise (Unknown_tracing !tracing)
| _ -> failwith ("Unknown trace format " ^ !tracing)
let trace_enabled () =
trace_fmt () <> No
......
......@@ -59,7 +59,7 @@ let mktop_decl d =
%token UCLOCK DCLOCK PHCLOCK TAIL
%token MERGE FBY WHEN WHENNOT
%token NODE LET TEL RETURNS VAR IMPORTED SENSOR ACTUATOR WCET
%token TINT TFLOAT TREAL TBOOL TCLOCK TUNSIGNED
%token TINT TFLOAT TREAL TBOOL TCLOCK
%token RATE DUE
%token EQ DIV
%token <string> INFIX0
......@@ -212,7 +212,6 @@ typ:
| TREAL {mktyp Tydec_float}
| TBOOL {mktyp Tydec_bool}
| TCLOCK {mktyp Tydec_clock}
|TUNSIGNED {mktyp Tydec_unsigned}
ident_list:
IDENT {[$1]}
......
......@@ -112,7 +112,6 @@ let tystring_of_type ty =
| Tint -> "int"
| Tfloat -> "float"
| Tbool | Tclock -> "int"
| Tunsigned -> "unsigned int"
| _ -> failwith "Internal error tystring_of_type"
let combuffer_name from_v to_v =
......
......@@ -27,8 +27,7 @@ let type_int = new_ty Tint
let type_float = new_ty Tfloat
let type_bool = new_ty Tbool
let type_clock = new_ty Tclock
let type_unsigned = new_ty Tunsigned
let type_notdef = new_ty Tnotdefint
let type_unary_bool_op =
new_ty (Tarrow (type_bool, type_bool))
......
......@@ -26,14 +26,10 @@ open Utils
type type_expr =
{mutable tdesc: type_desc;
tid: int}
and type_user =
Tsynon of ident * type_desc
| Tenum of ident * ident list
and type_desc =
Tvar (* Monomorphic type variable *)
| Tint
| Tunsigned
| Tnotdefint
| Tfloat
| Tbool
| Trat (* Actually unused for now. Only place where it can appear is
......@@ -42,7 +38,6 @@ and type_desc =
| Tarrow of type_expr * type_expr
| Ttuple of type_expr list
| Tlink of type_expr (* During unification, make links instead of substitutions *)
| Tuser of type_user
| Tunivar (* Polymorphic type variable *)
type error =
......@@ -92,7 +87,7 @@ let type_of_type_list tyl =
(** [is_polymorphic ty] returns true if [ty] is polymorphic. *)
let rec is_polymorphic ty =
match ty.tdesc with
| Tvar | Tint | Tfloat | Tbool | Trat | Tclock |Tunsigned | Tnotdefint | Tuser _ -> false
| Tvar | Tint | Tfloat | Tbool | Trat | Tclock -> false
| Tarrow (ty1,ty2) -> (is_polymorphic ty1) || (is_polymorphic ty2)
| Ttuple tl -> List.exists (fun t -> is_polymorphic t) tl
| Tlink t' -> is_polymorphic t'
......@@ -127,12 +122,6 @@ let rec print_ty ty =
| Tunivar ->
print_string "'";
print_string (name_of_type ty.tid)
| Tunsigned -> print_string "unsigned int"
| Tnotdefint -> print_string ""
| Tuser t -> match t with
Tsynon (name,tp) -> print_string name
| Tenum (name,clist) -> print_string name
let pp_error = function
| Unbound_value id ->
......
......@@ -45,7 +45,7 @@ let rec occurs tvar ty =
| Ttuple tl ->
List.exists (occurs tvar) tl
| Tlink t -> occurs tvar t
| Tunivar | Tint | Tfloat | Tbool | Trat | Tclock | Tunsigned | Tnotdefint | Tuser _ -> false
| Tunivar | Tint | Tfloat | Tbool | Trat | Tclock -> false
(** Promote monomorphic type variables to polymorphic type variables. *)
(* Generalize by side-effects *)
......@@ -60,13 +60,13 @@ let rec generalize ty =
List.iter generalize tlist
| Tlink t ->
generalize t
| Tunivar | Tint | Tfloat | Tbool | Tclock | Trat | Tunsigned | Tnotdefint | Tuser _ -> ()
| Tunivar | Tint | Tfloat | Tbool | Tclock | Trat -> ()
(** Downgrade polymorphic type variables to monomorphic type variables *)
let rec instanciate inst_vars ty =
let ty = repr ty in
match ty.tdesc with
| Tvar | Tint | Tfloat | Tbool | Tclock | Trat | Tunsigned | Tnotdefint | Tuser _ -> ty
| Tvar | Tint | Tfloat | Tbool | Tclock | Trat -> ty
| Tarrow (t1,t2) ->
{ty with tdesc =
Tarrow ((instanciate inst_vars t1), (instanciate inst_vars t2))}
......@@ -95,35 +95,31 @@ let rec unify t1 t2 =
(* No type abbreviations resolution for now *)
match t1.tdesc,t2.tdesc with
(* This case is not mandory but will keep "older" types *)
| Tvar, Tvar ->
| Tvar, Tvar ->
if t1.tid < t2.tid then
t2.tdesc <- Tlink t1
else
t1.tdesc <- Tlink t2
| (Tvar, _) when (not (occurs t1 t2)) ->
| (Tvar, _) when (not (occurs t1 t2)) ->
t1.tdesc <- Tlink t2
| (_,Tvar) when (not (occurs t2 t1)) ->
t2.tdesc <- Tlink t1
t2.tdesc <- Tlink t1
| Tarrow (t1,t2), Tarrow (t1',t2') ->
unify t1 t1'; unify t2 t2'
unify t1 t1'; unify t2 t2'
| Ttuple tlist1, Ttuple tlist2 ->
if (List.length tlist1) <> (List.length tlist2) then
raise (Unify (t1, t2))
else
List.iter2 unify tlist1 tlist2
if (List.length tlist1) <> (List.length tlist2) then
raise (Unify (t1, t2))
else
List.iter2 unify tlist1 tlist2
| Tint, Tint | Tbool, Tbool | Trat,Trat
| Tclock, Tclock | Tclock, Tbool | Tbool, Tclock
| Tunivar,_ | _, Tunivar ->
()
| Tnotdefint , Tint -> t1.tdesc <- Tint
| Tnotdefint , Tunsigned -> t1.tdesc <- Tunsigned
| Tint , Tnotdefint -> t2.tdesc <- Tint
| Tunsigned , Tnotdefint -> t2.tdesc <- Tint
()
| _,_ -> raise (Unify (t1, t2))
let type_of_const c =
match c with
| Const_int _ -> Type_predef.type_notdef
| Const_int _ -> Type_predef.type_int
| Const_float _ -> Type_predef.type_float
| Const_bool _ -> Type_predef.type_bool
......@@ -234,7 +230,6 @@ let type_coretype cty =
| Tydec_float -> Type_predef.type_float
| Tydec_bool -> Type_predef.type_bool
| Tydec_clock -> Type_predef.type_clock
| Tydec_unsigned -> Type_predef.type_unsigned
(* [type_coreclock env ck id loc] types the type clock declaration [ck]
in environment [env] *)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment