Results 1 -
1 of
1
Programmable Syntax Macros
, 1993
"... Lisp has shown that a programmable syntax macro system acts as an adjunct to the compiler that gives the programmer important and powerful abstraction facilities not provided by the language. Unlike simple token substitution macros, such as are provided by CPP #the C preprocessor#, syntax macros ope ..."
Abstract
-
Cited by 100 (0 self)
- Add to MetaCart
Lisp has shown that a programmable syntax macro system acts as an adjunct to the compiler that gives the programmer important and powerful abstraction facilities not provided by the language. Unlike simple token substitution macros, such as are provided by CPP #the C preprocessor#, syntax macros operate on Abstract Syntax Trees #ASTs#. Programmable syntax macro systems have not yet been developed for syntactically rich languages such as C because rich concrete syntax requires the manual construction of syntactically valid program fragments, which is a tedious, di#cult, and error prone process. Also, using two languages, one for writing the program, and one for writing macros, is another source of complexity. This research solves these problems byhaving the macro language be a minimal extension of the programming language, byintroducing explicit code template operators into the macro language, and by using a type system to guarantee, at macro de#nition time, that all macros and macro functions only produce syntactically valid program fragments. The code template operators make the language context sensitive, which requires changes to the parser. The parser must perform type analysis in order to parse macro de#nitions, or to parse user code that invokes macros. 1

