From aa3f38ada4299710c982b67db994c3684d7eeb4a Mon Sep 17 00:00:00 2001 From: Son Ho Date: Mon, 29 Nov 2021 21:22:08 +0100 Subject: Implement more utilities to print statements and expressions --- src/Print.ml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/Print.ml b/src/Print.ml index 0a340e69..22774c2a 100644 --- a/src/Print.ml +++ b/src/Print.ml @@ -821,7 +821,6 @@ end module PA = CfimAst (* local module *) (** Pretty-printing for ASTs (functions based on a definition context) *) - module DefCtxCfimAst = struct (** This function pretty-prints a type definition by using a definition context *) @@ -885,5 +884,12 @@ module DefCtxCfimAst = struct end (** Pretty-printing for ASTs (functions based on an evaluation context) *) - -module EvalCtxCfimAst = struct end +module EvalCtxCfimAst = struct + let statement_to_string (ctx : C.eval_ctx) (s : A.statement) : string = + let fmt = PA.eval_ctx_to_ast_formatter ctx in + PA.statement_to_string fmt s + + let expression_to_string (ctx : C.eval_ctx) (e : A.expression) : string = + let fmt = PA.eval_ctx_to_ast_formatter ctx in + PA.expression_to_string fmt "" " " e +end -- cgit v1.2.3