Few progress

This commit is contained in:
Denis Merigoux 2021-12-09 23:29:49 +01:00
parent c456a62cb3
commit 50400c445d
No known key found for this signature in database
GPG Key ID: EE99DCFA365C3EE3
4 changed files with 7 additions and 4 deletions

View File

@ -273,5 +273,6 @@ let rec format_expr (ctx : Ast.decl_ctx) (fmt : Format.formatter) (e : expr Pos.
Format.fprintf fmt "@[<hov 2>%a@ %a%a%a@]" format_keyword "assert" format_punctuation "("
format_expr e' format_punctuation ")"
let format_scope (_ctx : decl_ctx) (_fmt : Format.formatter) (_s : scope_body) =
failwith "unimplemented"
let format_scope (ctx : decl_ctx) (fmt : Format.formatter) ((n, s) : Ast.ScopeName.t * scope_body) =
Format.fprintf fmt "@[<hov 2>let %a = %a@]" Ast.ScopeName.format_t n (format_expr ctx)
(Ast.build_whole_scope_expr s)

View File

@ -44,4 +44,4 @@ val format_var : Format.formatter -> Ast.Var.t -> unit
val format_expr : Ast.decl_ctx -> Format.formatter -> Ast.expr Pos.marked -> unit
val format_scope : Ast.decl_ctx -> Format.formatter -> Ast.scope_body -> unit
val format_scope : Ast.decl_ctx -> Format.formatter -> Ast.ScopeName.t * Ast.scope_body -> unit

View File

@ -204,7 +204,7 @@ let driver (source_file : Pos.input_file) (debug : bool) (unstyled : bool)
Format.fprintf fmt "%a\n"
(Dcalc.Print.format_scope prgm.decl_ctx)
(let _, _, s = List.find (fun (name, _, _) -> name = scope_uid) prgm.scopes in
s)
(scope_uid, s))
else Format.fprintf fmt "%a\n" (Dcalc.Print.format_expr prgm.decl_ctx) prgrm_dcalc_expr;
at_end ();
exit 0

View File

@ -17,6 +17,8 @@ module D = Dcalc.Ast
module A = Ast
type ctx = A.expr Pos.marked Bindlib.box D.VarMap.t
(** This environment contains a mapping between the variables in Dcalc and their correspondance in
Lcalc. *)
let translate_lit (l : D.lit) : A.expr =
match l with