ikigai-go / compiler

Ikigai compiler
MIT License
0 stars 0 forks source link

Pattern matching #8

Open alfonsogarciacaro opened 5 years ago

alfonsogarciacaro commented 5 years ago

Obviously pattern matching must be one of the main features of Ikigai. For the beginning I was thinking to take advantage of the fact that switch cases in JS accept any expression to easily implement a limited pattern matching for unions. But maybe it's better to start directly with a full-powered pattern matching. This is not trivial, but we may be able to recycle some code from the F# compiler.

alfonsogarciacaro commented 5 years ago

Other references:

https://github.com/Microsoft/visualfsharp/blob/166ec385e1e3ffaa569dd70d1af2b7c063927391/src/fsharp/TastOps.fs#L5628

http://moscova.inria.fr/~maranget/papers/ml05e-maranget.pdf