aboutsummaryrefslogtreecommitdiff
path: root/discocaml/ast.ml
diff options
context:
space:
mode:
authorNathan Ringo <nathan@remexre.com>2024-01-19 17:33:46 -0600
committerNathan Ringo <nathan@remexre.com>2024-01-19 17:33:46 -0600
commit401bc1c5485e26329598d59a140e51f70f58857c (patch)
tree6ddb4f146808550e2c70fe38deed0db59d5b8cce /discocaml/ast.ml
parent87608eabbcbd105f5f5fecf7ab00a7bc93573477 (diff)
Fix diagrams, allow multiple roles.
Diffstat (limited to 'discocaml/ast.ml')
-rw-r--r--discocaml/ast.ml10
1 files changed, 10 insertions, 0 deletions
diff --git a/discocaml/ast.ml b/discocaml/ast.ml
index b5ebba3..a706a19 100644
--- a/discocaml/ast.ml
+++ b/discocaml/ast.ml
@@ -142,6 +142,16 @@ let parsetree_of_subexpr (ast : 'a ast) : expr -> Parsetree.expression =
(Pexp_apply
( Wrap.expression (Pexp_ident (Wrap.ident "+")),
[ (Nolabel, loop (subexpr l)); (Nolabel, loop (subexpr r)) ] ))
+ | Prim (`Sub, [| l; r |]) ->
+ Wrap.expression
+ (Pexp_apply
+ ( Wrap.expression (Pexp_ident (Wrap.ident "-")),
+ [ (Nolabel, loop (subexpr l)); (Nolabel, loop (subexpr r)) ] ))
+ | Prim (`Mul, [| l; r |]) ->
+ Wrap.expression
+ (Pexp_apply
+ ( Wrap.expression (Pexp_ident (Wrap.ident "*")),
+ [ (Nolabel, loop (subexpr l)); (Nolabel, loop (subexpr r)) ] ))
| Prim (p, xs) ->
failwith
("illegal Prim: " ^ [%derive.show: prim * expr index array] (p, xs))