Skip to main content
Open Access Publications from the University of California

UC Santa Cruz

UC Santa Cruz Electronic Theses and Dissertations bannerUC Santa Cruz

Hygienic Macros for JavaScript


Languages like Lisp, Scheme, and Racket have shown that powerful and expressive macro systems can give programmers the ability to grow their own language. Unfortunately, in languages with syntax like JavaScript, macros have had less success, due in part to the difficulty of integrating macro expansion and complex grammars.

This dissertation describes sweet.js, a hygienic macro system for JavaScript that fixes long standing challenges in lexing JavaScript and provides expressive pattern matching that allows macros to manipulate the complex grammar of JavaScript. With sweet.js programmers can experiment with syntax extensions for future versions of JavaScript and craft domain specific languages.

Main Content
For improved accessibility of PDF content, download the file to your device.
Current View