aboutsummaryrefslogtreecommitdiff
path: root/discocaml/ast.ml
diff options
context:
space:
mode:
Diffstat (limited to 'discocaml/ast.ml')
-rw-r--r--discocaml/ast.ml12
1 files changed, 12 insertions, 0 deletions
diff --git a/discocaml/ast.ml b/discocaml/ast.ml
index 009ea87..22f3790 100644
--- a/discocaml/ast.ml
+++ b/discocaml/ast.ml
@@ -1,3 +1,15 @@
type expr = Foo [@@deriving show { with_path = false }]
let expr_of_parsetree : Parsetree.expression -> expr = function _ -> Foo
+
+let parsetree_of_expr : expr -> Parsetree.expression =
+ let expression (pexp_desc : Parsetree.expression_desc) : Parsetree.expression
+ =
+ {
+ pexp_desc;
+ pexp_loc = Location.none;
+ pexp_loc_stack = [];
+ pexp_attributes = [];
+ }
+ in
+ function Foo -> expression (Pexp_constant (Pconst_char '!'))