yeslogic/fathom

Top-level items

brendanzab opened this issue · 0 comments

Currently a fathom file consists of a single expression. This is appealing in its simplicity, but in lieu of a fancier record-based module system (which is out of scope for Fathom), it is a pain to use in practice. The proposal is to switch to the following syntax:

module ::= item*

item ::= 
  | "def" ident (":" term)? "=" term ";"

Eventually we could extend this to support more top-level items, but this should work for now. This will unlock the following benefits:

  • allow us to topologically sort definitions before elaborating them, allowing definitions to be ordered from the roots to the leaves
  • allow us to more easily add imports to modules, allowing complicated formats to be broken up into smaller files
  • let users read from specific top-level formats via the CLI
  • make it easier to do an initial pass on glued evaluation