TY - GEN
T1 - Safely Composable Type-Specific Languages
AU - Omar, Cyrus
AU - Kurilova, Darya
AU - Nistor, Ligia
AU - Chung, Benjamin
AU - Potanin, Alex
AU - Aldrich, Jonathan
PY - 2014
Y1 - 2014
N2 - Programming languages often include specialized syntax for common datatypes (e.g. lists) and some also build in support for specific specialized datatypes (e.g. regular expressions), but user-defined types must use general-purpose syntax. Frustration with this causes developers to use strings, rather than structured data, with alarming frequency, leading to correctness, performance, security, and usability issues. Allowing library providers to modularly extend a language with new syntax could help address these issues. Unfortunately, prior mechanisms either limit expressiveness or are not safely composable: individually unambiguous extensions can still cause ambiguities when used together. We introduce type-specific languages (TSLs): logic associated with a type that determines how the bodies of generic literals, able to contain arbitrary syntax, are parsed and elaborated, hygienically. The TSL for a type is invoked only when a literal appears where a term of that type is expected, guaranteeing non-interference. We give evidence supporting the applicability of this approach and formally specify it with a bidirectionally typed elaboration semantics for the Wyvern programming language.
AB - Programming languages often include specialized syntax for common datatypes (e.g. lists) and some also build in support for specific specialized datatypes (e.g. regular expressions), but user-defined types must use general-purpose syntax. Frustration with this causes developers to use strings, rather than structured data, with alarming frequency, leading to correctness, performance, security, and usability issues. Allowing library providers to modularly extend a language with new syntax could help address these issues. Unfortunately, prior mechanisms either limit expressiveness or are not safely composable: individually unambiguous extensions can still cause ambiguities when used together. We introduce type-specific languages (TSLs): logic associated with a type that determines how the bodies of generic literals, able to contain arbitrary syntax, are parsed and elaborated, hygienically. The TSL for a type is invoked only when a literal appears where a term of that type is expected, guaranteeing non-interference. We give evidence supporting the applicability of this approach and formally specify it with a bidirectionally typed elaboration semantics for the Wyvern programming language.
KW - bidirectional typechecking
KW - extensible languages
KW - hygiene
KW - parsing
UR - https://www.scopus.com/pages/publications/84905384690
U2 - 10.1007/978-3-662-44202-9_5
DO - 10.1007/978-3-662-44202-9_5
M3 - Conference Paper
AN - SCOPUS:84905384690
SN - 978-3-662-44201-2
T3 - Lecture Notes in Computer Science
SP - 105
EP - 130
BT - ECOOP 2014 - Object-Oriented Programming
A2 - Jones, Richard
PB - Springer
CY - Heidelberg
T2 - 28th European Conference on Object-Oriented Programming, ECOOP 2014
Y2 - 28 July 2014 through 1 August 2014
ER -