A Standard Definition of Elm?
A formal definition of the Elm language: its grammar, its static semantics (which programs are legal, and their types) and its dynamic semantics (what they do), as numbered inference rules in the manner of The Definition of Standard ML. Every rule has its own page and a permanent address, so that it can be cited, linked to and discussed.
Draft. This edition is a draft for review. Many of its rulings are provisional, and rule numbers may change between editions; a rule's address, which uses its name, does not.
Also with a page each: 39 restrictions, 15 derived forms, 106 entries of the initial basis and 60 figures.
Mechanised. The static and dynamic semantics are encoded in the proof assistant Lean 4, one constructor per rule, with a type inference proved sound and principal and an evaluator proved sound and complete. Lean proves which of the suite's test programs are legal, and runs those that compile to prove their checks. See the Lean proofs, each with a page of its own.
Take part. Each of those pages, and each chapter, has a Discussions section: start a discussion of the item on GitHub with its Discuss link, and the discussion is shown on the page. See all the discussions, or the Standard category of the repository's GitHub Discussions.
Contents
- Preface
- 1Introduction
- 2Syntax of the Core
- 3Syntax of Modules
- 4Static Semantics for the Corerules 1–45
- 5Static Semantics for Modulesrules 46–64
- 6Dynamic Semantics for the Corerules 65–112
- 7Dynamic Semantics for Modulesrules 113–132
- 8Tasks, Commands, Subscriptions and Portsrules 133–171
- 9Programsrules 172–194
Appendices
- ADerived Forms
- BFull Grammar
- CThe Initial Static Basis
- DThe Initial Dynamic Basis
- EImplementation-Dependent Details
- FElm and Standard ML
A Standard Definition of Elm? (Draft version 0.4) © Rupert Smith. The text is licensed under CC BY 4.0: share and adapt it freely, with credit and a link to the licence.