cakeml icon indicating copy to clipboard operation
cakeml copied to clipboard

Support pattern matching in let declarations

Open xrchz opened this issue 8 years ago • 3 comments

Currently the grammar only supports a limited subset of declarations within let expressions (the LetDec non-terminal). It would be nice if these could be expanded to allow pattern-matching and wildcards.

(Supporting everything in Decl would be great, but presumably local type declarations are the problem. This issue can be closed without supporting them.)

xrchz avatar Apr 27 '17 04:04 xrchz

The grammar and parsing for this change would be easy. The more significant change would be giving this syntax a target in the AST type and then ensuring that those ASTs were properly compiled. (For example, when you have val inside a let it can only be a variable name because that's what the ast$Let constructor allows . This contrasts with the fact that val as part of a top-level declaration takes a pattern.)

mn200 avatar Apr 28 '17 05:04 mn200

Right, this is mostly an AST enhancement/complication. @SOwens might like to weigh in.

xrchz avatar Apr 28 '17 05:04 xrchz

Related to #264

xrchz avatar Nov 12 '24 13:11 xrchz