diff options
author | Son Ho | 2021-11-29 21:22:08 +0100 |
---|---|---|
committer | Son Ho | 2021-11-29 21:22:08 +0100 |
commit | aa3f38ada4299710c982b67db994c3684d7eeb4a (patch) | |
tree | 7fa590bac1f7980fdafc985a6d029995e1268993 /src | |
parent | 62e8722678574643cc1888864d0bc66804ee14b4 (diff) |
Implement more utilities to print statements and expressions
Diffstat (limited to '')
-rw-r--r-- | src/Print.ml | 12 |
1 files changed, 9 insertions, 3 deletions
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 |