Adapting Scheme-Like Macros to a C-Like Language
Workshop on Scheme and Functional Programming (Scheme) 2011.
ZL is a C++-compatible language in which high-level constructs, such as classes, are defined using macros over a C-like core. ZL’s parser and macro expander are similar to that of Scheme. Unlike Scheme, however, ZL must deal with C’s richer syntax. Specifically, support for context-sensitive parsing and multiple syntactic categories (expressions, statements, types, etc.) leads to novel strategies for parsing and macro expansion. In this paper we describe ZL’s approach to parsing and macros.