Reason is an increasingly popular alternative syntax for OCaml designed to make OCaml more syntactically familiar to contemporary programmers. However, both Reason and OCaml build in literal notation for only a select few data structures, e.g. lists, arrays and, in the case of Reason, a variant on HTML notation. This is unsatisfying because there are many other notations that would be useful to programmers in various domains.
In a paper that appeared at ICFP 2018, Omar and Aldrich address this deficiency by introducing typed literal macros (TLMs) into Reason. TLMs allow library providers to define new literal notation for the data structures that they have defined. Unlike prior approaches, e.g. camlp4, and ppx-based string literal rewriting, both explored in the OCaml ecosystem, TLMs come equipped with powerful abstract reasoning principles — clients do not need to peek at the underlying expansion or the implementation of the parser to reason about types and binding.
We will introduce and give a live demonstration of Relit, our implementation of TLMs for Reason, using a few simple but non-trivial motivating case studies. In the course of this demonstration, we will show how these reasoning principles can be put into practice. The submitted abstract summarizes one of the case studies that we will demonstrate: a TLM that implements POSIX-style regex notation, with notational support for splicing one regex into another. Relit is the first typed hygienic macro system with support for parsing arbitrary notations.
Mon 5 Nov
|10:30 - 11:30|
Eugene BurmakoTwitter, Inc.DOI
|11:30 - 12:00|
|Link to publication|