Staapl is a collection of abstractions for metaprogramming microcontrollers from within PLT Scheme. The core of the system is a programmable code generator structured around a functional concatenative macro language adapted to a 2-stack machine model. On top of this it includes a syntax frontend for creating Forth style languages, a backend code generator for the Microchip PIC18 microcontroller architecture, and interaction tools for shortening the edit-compile-run cycle. It is structured as a code library to facilitate integration into larger systems employing a model-based design approach. The primary, practical goal is to provide a tool chain for programming low-end (8-bit) microcontrollers in a Forth-style language extended with powerful metaprogramming facilities. The secondary goal is to generalize and modularize this approach and extend it in two directions: to provide a standard machine model as an abstraction point for a large class of small embedded processo
"Generalized Algebraic Data Structures" have become a a hot new topic. They have recently been added to the GHC compiler. They support the construction, maintenance, and propagation of semantic properties of programs using powerful old ideas about types (the Curry-Howard Isomorphism) in surprisingly easy to understand new ways. The language Omega was designed and implemented to demonstrate their utility. Here a a few talks I gave that explains how they work. Also class lectures
for 6.10 We show how to build a quasiquoter for a simple mathematical expression language. Although the example is small, it demonstrates all aspects of building a quasiquoter. We do not mean to suggest that one gains much from a quasiquoter for such a small language relative to using abstract syntax directly except from a pedagogical point of view---this is just a tutorial!
An ingenious set of combinators for expressing pattern matching in a type-safe way. No ADTs required. Opens up the possibility of programming languages where we can declare new binding forms just as we declare new functions. abstract: Macros still have not made their way into typed higher-order programming languages such as Haskell and Standard ML. Therefore, to extend the expressiveness of Haskell or Standard ML gradually, one must express new linguistic features in terms of functions that fit within the static type systems of these languages. This is particularly challenging when introducing features that span across multiple types and that bind variables. We address this challenge by developing, in a step-by-step manner, mechanisms for encoding patterns and pattern matching in Haskell in a type-safe way.
c2005 Most new ideas in software developments are really new variations on old ideas. This article describes one of these, the growing idea of a class of tools that I call Language Workbenches - examples of which include Intentional Software, JetBrains's Meta Programming System, and Microsoft's Software Factories. These tools take an old style of development - which I call language oriented programming and use IDE tooling in a bid to make language oriented programming a viable approach. Although I'm not enough of a prognosticator to say whether they will succeed in their ambition, I do think that these tools are some of the most interesting things on the horizon of software development. Interesting enough to write this essay to try to explain, at least in outline, how they work and the main issues around their future usefulness.
In our professional software development, we have focused on finding ways to help developers work more effectively. Despite the range of programming languages available today, we are still limited by them. It makes sense to extend the existing languages to create more domain-oriented ones, which allow writing programs on a higher level and in a manner that is more natural to each domain. With an instrument that allows creating language constructs as simple as creating classes or methods is in a conventional language, you can significantly change the way you develop software. This new style of programming, when you create specialized languages, use them to develop software, and extend them when and how required, is called Language Oriented Programming (LOP). MPS Story Meta Programming System started in 2003 as a research project. In 2004, its underlying concepts were described in the Language Oriented Programming article.
Standard ML is often used to implement another language L, for example, the syntax of the HOL logic in hol90 or the syntax of CCS for the Concurrency Workbench. Typically, one defines the abstract syntax of L by a datatype declaration. Then useful functions over the datatype can be defined (such as finding the free variables of a formula when L is a logic). Soon afterwards, one concludes that concrete syntax is easier for humans to read than abstract syntax, and so writes a parser and prettyprinter for L. In the situation just outlined, ML is called the metalanguage, and L is called the object language, or OL. (Edinburgh/INRIA/Cambridge ML, the precursor to Standard ML, was originally a programming metalanguage for a particular object language, the LCF logic.) The purpose of a quotation/antiquotation mechanism is to allow one to embed expressions in the object language's concrete syntax inside of ML programs, and to mix the object language expressions with ML expressions.
Grammar Based Definition Of Metaprogramming Systems Program-Transformation.Org: The Program Transformation Wiki Robert Cameron? and Robert Ito?. Grammar-Based Definition of Metaprogramming Systems. ACM Transactions on Programming Languages and Systems Vol. 6, No. 1, January 1984, Pages 20-54. (ACM Digital Library) Summary This paper describes the GRAMPS method for meta-programming. GRAMPS stands for GRAmmar-based MetaProgramming Scheme. The method basically describes how abstract syntax tree? manipulation can be done in a general-purpose programming language. Given an API for analyzing and constructing syntax trees, transformations can be expressed.
E. Visser. Meta-programming with concrete object syntax. In D. Batory, C. Consel, and W. Taha, editors, Generative Programming and Component Engineering (GPCE'02), volume 2487 of Lecture Notes in Computer Science, pages 299-315, Pittsburgh, PA, USA, October 2002. Springer-Verlag. Meta programs manipulate structured representations (abstract syntax) of programs. The distance between the concrete syntax meta-programmers use to reason about programs and the notation for abstract syntax manipulation provided by general purpose (meta-) programming languages is too great for many applications. In this paper it is shown how the syntax definition formalism SDF can be employed to fit a meta-programming language with concrete syntax notation for composing and analyzing object programs. As a case study, the addition of concrete syntax to the program transformation language Stratego is presented. The approach is then generalized to arbitrary meta-languages.