From 7a20fdcb37a1e7ac0f86d455c616d0a39d9d92bd Mon Sep 17 00:00:00 2001 From: Alasdair Armstrong Date: Wed, 28 Jun 2017 19:35:57 +0100 Subject: User defined overloaded operators New typechecker has no builtin overloaded operators - instead can now write something in SAIL like: overload (deinfix +) [id1; id2; id3] to set up functions id1, id2, and id3 as overloadings for the + operator. Any identifier can be overloaded, not just infix ones. This is done in a backwards compatible way, so the old typechecker removes the DEF_overload nodes from the ast so the various backends never see it. --- src/parse_ast.ml | 1 + 1 file changed, 1 insertion(+) (limited to 'src/parse_ast.ml') diff --git a/src/parse_ast.ml b/src/parse_ast.ml index c6af651b..cfb09bf5 100644 --- a/src/parse_ast.ml +++ b/src/parse_ast.ml @@ -488,6 +488,7 @@ def = (* Top-level definition *) | DEF_type of type_def (* type definition *) | DEF_fundef of fundef (* function definition *) | DEF_val of letbind (* value definition *) + | DEF_overload of id * id list (* operator overload specifications *) | DEF_spec of val_spec (* top-level type constraint *) | DEF_default of default_typing_spec (* default kind and type assumptions *) | DEF_scattered of scattered_def (* scattered definition *) -- cgit v1.2.3