Safely Composable Type-Specific Languages

被引:0
作者
Omar, Cyrus [1 ]
Kurilova, Darya [1 ]
Nistor, Ligia [1 ]
Chung, Benjamin [1 ]
Potanin, Alex [2 ]
Aldrich, Jonathan [1 ]
机构
[1] Carnegie Mellon Univ, Pittsburgh, PA 15213 USA
[2] Victoria Univ Wellington, Wellington, New Zealand
来源
ECOOP 2014 - OBJECT-ORIENTED PROGRAMMING | 2014年 / 8586卷
关键词
extensible languages; parsing; bidirectional typechecking; hygiene;
D O I
暂无
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
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.
引用
收藏
页码:105 / 130
页数:26
相关论文
共 36 条
[1]  
Adams M. D., 2013, PRINCIPLES PROGRAMMI
[2]  
Bravenboer M, 2005, LECT NOTES COMPUT SC, V3676, P157
[3]  
Clark T., 2008, SOURCE CODE ANAL MAN
[4]  
de Rauglaudre Daniel., 2003, CAMLP4 REFERENCE MAN
[5]  
Diekmann L., 2013, WORKSH SCAL LANG SPE
[6]  
Erdweg S., 2011, OBJECT ORIENTED PROG
[7]   Usability analysis of visual programming environments: A 'cognitive dimensions' framework [J].
Green, TRG ;
Petre, M .
JOURNAL OF VISUAL LANGUAGES AND COMPUTING, 1996, 7 (02) :131-174
[8]  
Harper R, 2000, FOUNDAT COMPUT, P341
[9]  
Harper Robert, 2012, Practical Foundations for Programming Languages, DOI DOI 10.1017/CBO9781139342131
[10]  
Ichikawa K., 2014, MODULARITY