Clock annotation in Hept AST

This commit is contained in:
Léonard Gérard 2010-11-23 17:13:33 +01:00
parent 9998d7ea39
commit 9a69c30dc5
7 changed files with 18 additions and 27 deletions

View file

@ -1,4 +1,4 @@
(**************************************************************************)
(**************************************************************************)
(* *)
(* Heptagon *)
(* *)
@ -26,9 +26,10 @@ type iterator_type =
| Imapfold
type exp = {
e_desc : desc;
e_ty : ty;
e_loc : location }
e_desc : desc;
e_ty : ty;
e_ct_annot : ct;
e_loc : location }
and desc =
| Econst of static_exp
@ -179,8 +180,8 @@ and interface_desc =
| Isignature of signature
(* Helper functions to create AST. *)
let mk_exp desc ty =
{ e_desc = desc; e_ty = ty; e_loc = no_location; }
let mk_exp desc ?(ct_annot = Clocks.invalid_clock) ty =
{ e_desc = desc; e_ty = ty; e_ct_annot = ct_annot; e_loc = no_location; }
let mk_op ?(params=[]) ?(unsafe=false) op =
{ a_op = op; a_params = params; a_unsafe = unsafe }

View file

@ -59,6 +59,7 @@ type ty =
and exp =
{ e_desc : edesc;
e_ct_annot : Clocks.ct;
e_loc : location }
and edesc =
@ -206,8 +207,8 @@ and interface_desc =
(* {3 Helper functions to create AST} *)
let mk_exp desc loc =
{ e_desc = desc; e_loc = loc }
let mk_exp desc ?(ct_annot = Clocks.invalid_clock) loc =
{ e_desc = desc; e_ct_annot = ct_annot; e_loc = loc }
let mk_app op params =
{ a_op = op; a_params = params }

View file

@ -222,6 +222,7 @@ let rec translate_exp env e =
try
{ Heptagon.e_desc = translate_desc e.e_loc env e.e_desc;
Heptagon.e_ty = Types.invalid_type;
Heptagon.e_ct_annot = e.e_ct_annot;
Heptagon.e_loc = e.e_loc }
with ScopingError(error) -> message e.e_loc error

View file

@ -63,7 +63,7 @@ let rec translate_pat map = function
List.fold_right (fun pat acc -> (translate_pat map pat) @ acc)
pat_list []
let translate_var_dec l = (*TODO bug map unused ?*)
let translate_var_dec l =
let one_var { Minils.v_ident = x; Minils.v_type = t; v_loc = loc } =
mk_var_dec ~loc:loc x t
in

View file

@ -12,23 +12,7 @@ open Compiler_utils
open Compiler_options
let pp p = if !verbose then Mls_printer.print stdout p
(*
let parse parsing_fun lexing_fun lexbuf =
try
parsing_fun lexing_fun lexbuf
with
| Mls_lexer.Lexical_error(err, loc) ->
lexical_error err loc
| Mls_parser.Error ->
let pos1 = Lexing.lexeme_start_p lexbuf
and pos2 = Lexing.lexeme_end_p lexbuf in
let l = Loc(pos1,pos2) in
syntax_error l
let parse_implementation prog_name lexbuf =
let p = parse Mls_parser.program Mls_lexer.token lexbuf in
{ p with Mls_parsetree.p_modname = prog_name }
*)
let compile pp p =
(* Clocking *)
let p = pass "Clocking" true Clocking.program p pp in

View file

@ -39,10 +39,10 @@ and tdesc =
| Type_struct of structure
and exp = {
e_desc: edesc;
e_desc : edesc;
mutable e_ck: ck;
mutable e_ty: ty;
e_loc: location }
e_loc : location }
and edesc =
| Econst of static_exp

View file

@ -7,4 +7,8 @@ Plus ou moins ordonné du plus urgent au moins urgent.
*- Compléter la passe "static.ml" pour gérer l'ensemble des opérateurs de pervasives
*- Permettre les déclarations des types et des noeuds et des constantes dans un ordre quelconque.
*- Permettre la définition de constantes locales.
*- Optimiser le reset en utilisant un memcopy ?