Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/2695664.2695936acmconferencesArticle/Chapter ViewAbstractPublication PagessacConference Proceedingsconference-collections
research-article

Composable and hygienic typed syntax macros

Published: 13 April 2015 Publication History

Abstract

Syntax extension mechanisms are powerful, but reasoning about syntax extensions can be difficult. Recent work on type-specific languages (TSLs) addressed reasoning about composition, hygiene and typing for extensions introducing new literal forms. We supplement TSLs with typed syntax macros (TSMs), which, unlike TSLs, are explicitly invoked to give meaning to delimited segments of arbitrary syntax. To maintain a typing discipline, we describe two avors of term-level TSMs: synthetic TSMs specify the type of term that they generate, while analytic TSMs can generate terms of arbitrary type, but can only be used in positions where the type is otherwise known. At the level of types, we describe a third avor of TSM that generates a type of a specified kind along with its TSL and show interesting use cases where the two mechanisms operate in concert.

References

[1]
SML/NJ Quote/Antiquote. http://www.smlnj.org/doc/quote.html.
[2]
M. D. Adams. Principled Parsing for Indentation-Sensitive Languages: Revisiting Landin's Offside Rule. In POPL, 2013.
[3]
A. Bawden. Quasiquotation in Lisp. In Partial Evaluation and Semantic-Based Program Manipulation, 1999.
[4]
E. Burmako. Scala Macros: Let Our Powers Combine!: On How Rich Syntax and Static Types Work with Metaprogramming. In Proceedings of the 4th Workshop on Scala, SCALA, 2013.
[5]
R. K. Dybvig, R. Hieb, and C. Bruggeman. Syntactic abstraction in Scheme. Lisp Symb. Comput., 5(4):295--326, Dec. 1992.
[6]
S. Erdweg, T. Rendel, C. Kastner, and K. Ostermann. SugarJ: Library-based syntactic language extensibility. In OOPSLA, 2011.
[7]
S. Erdweg and F. Rieger. A framework for extensible languages. In GPCE, 2013.
[8]
T. Griffin. Notational definition-a formal account. In Logic in Computer Science, 1988.
[9]
K. Ichikawa and S. Chiba. Composable user-defined operators that can express user-defined literals. In MODULARITY, 2014.
[10]
X. Leroy, D. Doligez, A. Frisch, J. Garrigue, D. Rémy, and J. Vouillon. The OCaml system release 4.01 Documentation and user's manual. Institut National de Recherche en Informatique et en Automatique, September 2013.
[11]
F. Lorenzen and S. Erdweg. Modular and automated type-soundness verification for language extensions. In ICFP, 2013.
[12]
The Coq development team. The Coq proof assistant reference manual. LogiCal Project, 2004. Version 8.0.
[13]
C. Omar, D. Kurilova, L. Nistor, B. Chung, A. Potanin, and J. Aldrich. Safely composable type-specific languages. In ECOOP, 2014.
[14]
C. Omar, C. Wang, and J. Aldrich. Composable and hygienic typed syntax macros. Technical Report CMU-ISR-14-113, Carnegie Mellon University.
[15]
B. C. Pierce and D. N. Turner. Local type inference. ACM Trans. Program. Lang. Syst., 22(1):1--44, Jan. 2000.
[16]
W. V. O. Quine. Mathematical Logic. Harvard University Press, Boston, MA, 1940.
[17]
C. Scaffidi, A. Cypher, S. Elbaum, A. Koesnandar, J. Lin, B. Myers, and M. Shaw. Using topes to validate and reformat data in end-user programming tools. In 4th International Workshop on End-User Software Engineering, 2008.
[18]
A. Schwerdfeger and E. V. Wyk. Verifiable composition of deterministic grammars. In PLDI, 2009.
[19]
K. Skalski, M. Moskal, and P. Olszta. Meta-programming in Nemerle. In GPCE, 2004.
[20]
G. L. Steele. Common LISP: the language. Digital Press, 1990.

Cited By

View all
  • (2018)Reasonably programmable literal notationProceedings of the ACM on Programming Languages10.1145/32368012:ICFP(1-32)Online publication date: 30-Jul-2018

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
SAC '15: Proceedings of the 30th Annual ACM Symposium on Applied Computing
April 2015
2418 pages
ISBN:9781450331968
DOI:10.1145/2695664
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 13 April 2015

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. extensible syntax
  2. hygiene
  3. macros
  4. type inference

Qualifiers

  • Research-article

Funding Sources

  • National Security Agency

Conference

SAC 2015
Sponsor:
SAC 2015: Symposium on Applied Computing
April 13 - 17, 2015
Salamanca, Spain

Acceptance Rates

SAC '15 Paper Acceptance Rate 291 of 1,211 submissions, 24%;
Overall Acceptance Rate 1,650 of 6,669 submissions, 25%

Upcoming Conference

SAC '25
The 40th ACM/SIGAPP Symposium on Applied Computing
March 31 - April 4, 2025
Catania , Italy

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)4
  • Downloads (Last 6 weeks)0
Reflects downloads up to 01 Feb 2025

Other Metrics

Citations

Cited By

View all
  • (2018)Reasonably programmable literal notationProceedings of the ACM on Programming Languages10.1145/32368012:ICFP(1-32)Online publication date: 30-Jul-2018

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media