AnyDSL / MimIR

MimIR is my Intermediate Representation
https://anydsl.github.io/MimIR/
MIT License
46 stars 9 forks source link

Feature/fun #207

Closed leissa closed 1 year ago

leissa commented 1 year ago

This adds .fun decls, .fn exprs, and .Fn types.

You can now write decls like this:

.fun f (T: *)(a: T, b: T) -> T = return a;

which means the same as

.con f (T: *)((a: T, b: T), return: .Cn T) = return a;

There is an according expr available:

.let f = .fn (T: *)(a: T, b: T) -> T = return a;

And a type:

.let F = .Fn [T: *][T, T] -> T;

Continuation types can now also be curried:

.let K = .Cn [T: *][T, T];

Finally, you can invoke returning continuations with the ret expression:

.let res = f .Nat $ (23, 42);
use(res)

Includes already #206.