Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Top-level items #318

Closed
brendanzab opened this issue Mar 25, 2022 · 0 comments · Fixed by #338
Closed

Top-level items #318

brendanzab opened this issue Mar 25, 2022 · 0 comments · Fixed by #338

Comments

@brendanzab
Copy link
Member

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant