pure icon indicating copy to clipboard operation
pure copied to clipboard

Extend PureLang `cexp` with annotations

Open hrutvik opened this issue 1 year ago • 1 comments

Add an Annot form to cexp as follows:

annot = Inline mlstring | ...

cexp = ... | Annot annot cexp

This should desugar as follows: exp_of (Annot _ ce) = exp_of ce.

hrutvik avatar Feb 09 '24 15:02 hrutvik

Discussion in meeting:

Annotation types: annot = NoInline | Inline | Inlineable | ConLike | InlineHere mlstring | ...

  • For top-level functions, expect annotations to be introduced on RHS, i.e. Let x (Annot Inline e1) e2. This means that annotations appear around lambdas, so the inliner needs to ensure it looks under Annot when considering arities.
  • Pragmas to support
    • Top-level pragmas mirroring GHC: {-# INLINEABLE f #-}, {-# INLINE f #-}, {-# NOINLINE f #-}, {-# CONLIKE #-}
    • Special function for inlining at a specific call-site: #(__inline), akin to GHC's inline
    • {-# INLINE_IN_SCOPE f #-} (or similar): a variant of #(__inline) which applies to the current scope, i.e. wrap the entire scope in an InlineHere <name> expression

hrutvik avatar Feb 29 '24 09:02 hrutvik