Results 11 - 20
of
21
Macros that Compose: Systematic Macro Programming
- LECTURE NOTES IN COMPUTER SCIENCE
, 2002
"... Macros are often regarded as a sort of black magic: highly useful yet abstruse. The present paper aims to make macro programming more like a craft. Using R5RS Scheme macros as an example, we develop and present a general practical methodology of building complex macros systematically, by combini ..."
Abstract
-
Cited by 5 (0 self)
- Add to MetaCart
Macros are often regarded as a sort of black magic: highly useful yet abstruse. The present paper aims to make macro programming more like a craft. Using R5RS Scheme macros as an example, we develop and present a general practical methodology of building complex macros systematically, by combining simpler components by functional composition or higher-order operators.
Contrasting compile-time meta-programming in Metalua and Converge
"... Abstract. Powerful, safe macro systems allow programs to be programatically constructed by the user at compile-time. Such systems have traditionally been largely confined to LISP-like languages and their successors. In this paper we describe and compare two modern, dynamically typed languages Conver ..."
Abstract
-
Cited by 4 (3 self)
- Add to MetaCart
Abstract. Powerful, safe macro systems allow programs to be programatically constructed by the user at compile-time. Such systems have traditionally been largely confined to LISP-like languages and their successors. In this paper we describe and compare two modern, dynamically typed languages Converge and Metalua, which both have macro-like systems. We show how, in different ways, they build upon traditional macro systems to explore new ways of constructing programs. 1
Maya: Multiple-Dispatch Syntax Extension in Java
, 2002
"... We have designed and implemented Maya, a version of Java that allows programmers to extend and reinterpret its syntax. Maya generalizes macro systems by treating grammar productions as generic functions, and semantic actions on productions as multimethods on the corresponding generic functions. Prog ..."
Abstract
-
Cited by 3 (0 self)
- Add to MetaCart
We have designed and implemented Maya, a version of Java that allows programmers to extend and reinterpret its syntax. Maya generalizes macro systems by treating grammar productions as generic functions, and semantic actions on productions as multimethods on the corresponding generic functions. Programmers can write new generic functions (i.e., grammar productions) and new multimethods (i.e., semantic actions), through which they can extend the grammar of the language and change the semantics of its syntactic constructs, respectively. Maya's multimethods are compile-time metaprograms that transform abstract syntax: they execute at program compile-time, because they are semantic actions executed by the parser. Maya's multimethods can be dispatched on the syntactic structure of the input, as well as the static, source-level types of expressions in the input.
Directly reflective meta-programming
- Journal of Higher Order and Symbolic Computation
, 2008
"... Existing meta-programming languages operate on encodings of programs as data. This paper presents a new meta-programming language, based on an untyped lambda calculus, in which structurally reflective programming is supported directly, without any encoding. The language features call-by-value and ca ..."
Abstract
-
Cited by 2 (0 self)
- Add to MetaCart
Existing meta-programming languages operate on encodings of programs as data. This paper presents a new meta-programming language, based on an untyped lambda calculus, in which structurally reflective programming is supported directly, without any encoding. The language features call-by-value and call-by-name lambda abstractions, as well as novel reflective features enabling the intensional manipulation of arbitrary program terms. The language is scope safe, in the sense that variables can neither be captured nor escape their scopes. The expressiveness of the language is demonstrated by showing how to implement quotation and evaluation operations, as proposed by Wand. The language’s utility for meta-programming is further demonstrated through additional representative examples. A prototype implementation is described and evaluated.
Compile-time meta-programming in Converge
, 2004
"... Compile-time meta-programming allows programs to be constructed by the user at compile-time. Few modern languages are capable of compile-time meta-programming, and of those that do, many of the most powerful are statically typed functional languages. In this paper I present the dynamically typed ..."
Abstract
-
Cited by 2 (0 self)
- Add to MetaCart
Compile-time meta-programming allows programs to be constructed by the user at compile-time. Few modern languages are capable of compile-time meta-programming, and of those that do, many of the most powerful are statically typed functional languages. In this paper I present the dynamically typed, object orientated language Converge which allows compile-time meta-programming in the spirit of Template Haskell. Converge demonstrates that integrating powerful, safe compiletime meta-programming features into a dynamic language requires few restrictions to the flexible development style facilitated by the paradigm.
A Semantic Analysis of C++ Templates
, 2006
"... Templates are a powerful but poorly understood feature of the C++ language. Their syntax resembles the parameterized classes of other languages (e.g., of Java). But because C++ supports template specialization, their semantics is quite di#erent from that of parameterized classes. Template specia ..."
Abstract
-
Cited by 2 (0 self)
- Add to MetaCart
Templates are a powerful but poorly understood feature of the C++ language. Their syntax resembles the parameterized classes of other languages (e.g., of Java). But because C++ supports template specialization, their semantics is quite di#erent from that of parameterized classes. Template specialization provides a Turing-complete sub-language within C++ that executes at compile-time. Programmers put this power to many uses. For example, templates are a popular tool for writing program generators.
Efficient Code Generation for a Domain Specific Language
- In Generative Programming and Component Engineering
, 2005
"... We present a domain-specific-language (DSL) for writing instances of a class of filter programs. The values in the language are symbolic and independent of a concrete precision. Efficient code generation is required to fit the program onto a target device limited in both memory and processing power. ..."
Abstract
-
Cited by 2 (1 self)
- Add to MetaCart
We present a domain-specific-language (DSL) for writing instances of a class of filter programs. The values in the language are symbolic and independent of a concrete precision. Efficient code generation is required to fit the program onto a target device limited in both memory and processing power. We construct an interpreter for the DSL in a language specific to the device which contains the semantics of the target instruction set embedded within a declarative meta-language. The compiler is automatically generated from the interpreter through specialisation. This extension of the instruction set allows...
How to Write Seemingly Unhygienic and Referentially Opaque Macros with Syntax-rules
"... This paper details how folklore notions of hygiene and referential transparency of R5RS macros are defeated by a systematic attack. We demonstrate syntax-rules that seem to capture user identiers and allow their own identiers to be captured by the closest lexical bindings. In other words, we have wr ..."
Abstract
-
Cited by 1 (0 self)
- Add to MetaCart
This paper details how folklore notions of hygiene and referential transparency of R5RS macros are defeated by a systematic attack. We demonstrate syntax-rules that seem to capture user identiers and allow their own identiers to be captured by the closest lexical bindings. In other words, we have written R5RS macros that accomplish what commonly believed to be impossible. We build on the the fundamental technique by Petrofsky of extracting variables from arguments of a macro. The present paper generalizes Petrofsky's idea to attack referential transparency.
Meta-programming in Nemerle
"... Abstract. We present the design of a meta-programming system embedded into Nemerle 1, a new functional language for the.NET platform. The system enables compile-time operations – generation, transformation and automated analysis of programs by means of hygienic code quotation, syntax extensions, ope ..."
Abstract
-
Cited by 1 (0 self)
- Add to MetaCart
Abstract. We present the design of a meta-programming system embedded into Nemerle 1, a new functional language for the.NET platform. The system enables compile-time operations – generation, transformation and automated analysis of programs by means of hygienic code quotation, syntax extensions, operating on the code like on any other datatype (e.g. listing, adding or changing members of class definition), performing partial typing of a program syntax tree (compiler internal typing procedures are executed by a macro code) and interoperability with the compilation process. All these operations can be fully parametrized with any external data (like a database, a file or a web page). Our system is a convenient tool for Aspects Oriented Programming with the ability to operate on datatypes, traverse the program code and perform various algorithmic operations on its content. 1
A Few Principles of Macro Design
"... Hygiene facilitates the implementation of reliable macros but does not guarantee it. In this note we review the introspective capabilities of macros, discuss the problems caused by abusing this power, and suggest a few principles for designing well-behaved macros. 1. ..."
Abstract
- Add to MetaCart
Hygiene facilitates the implementation of reliable macros but does not guarantee it. In this note we review the introspective capabilities of macros, discuss the problems caused by abusing this power, and suggest a few principles for designing well-behaved macros. 1.

