Collection of Great Applications and Programs using Macros

我与影子孤独终老i 提交于 2019-11-28 02:49:07

Culpepper & Felleisen, Fortifying Macros, ICFP 2010

Culpepper, Tobin-Hochstadt and Felleisen, Advanced Macrology and the Implementation of Typed Scheme, Scheme Workshop 2007

Flatt, Findler, Felleisen, Scheme with Classes, Mixins, and Traits, APLAS 2006

Herman, Meunier, Improving the Static Analysis of Embedded Languages via Partial Evaluation, ICFP 2004

Charles Stewart

Shivers, Carlstrom, Gasbichler & Sperber (1994 & later) The Scsh Reference manual.

Has a lot of good examples of using macros to embed mini-languages into Scheme. Introduced me to the technique of defining macros that implicitly quote their argument. Look at the use of process forms, regular expressions, and the awk-like mini-languages. Scsh is my recommendation as a starting point for playing with macros.

Hilsdale & Friedman (2000) Writing Macros in Continuation-Passing Style.

Shows how the weak syntax-rules macros can be made powerful using continuation-passing style. Gives plenty of examples.

Flatt, Culpepper, Darais & Findler (submitted) Macros that Work Together - Compile-Time Bindings, Partial Expansion, and Definition Contexts.

Provides an overview of, and semantics for the approach to macros in Racket/PLT Scheme. Not a whole lot of examples, but I think the paper has something you are looking for.

ReadScheme! Remember to check the extensive bibliography on ReadScheme.

http://library.readscheme.org/page3.html

One example I think you missed is embedding SQL syntax into Scheme. http://repository.readscheme.org/ftp/papers/sw2002/schemeunit-schemeql.pdf

Macros are also used to write supports for automated testing.

Not a Scheme, but somewhat similar Lisp dialect with a very extensive use of macros: http://www.meta-alternative.net/mbase.html

There are macros implementing various kinds of pattern matching, list comprehensions, various parsers generators (including a PEG/Packrat implementation), embedded Prolog, ADT visitors inference (like scrap your boilerplate in Haskell), extensible syntax macros, Hindley-Milner type system, Scheme-like syntax macros, and many more. Parts of that functionality can be potentially ported to Scheme, other parts needs an extended macro system with explicit context.

I would add "The Scheme standard library itself" to the list. Look at the file boot-9.scm in the guile distribution. Many of the most commonly-used Scheme forms - case, and, etc. - are defined there as macros.

This isn't particularly precise in so far as it is spread out over a large number of very old publications most of which i've never read, but IIRC large chunks of the Common Lisp Object System and the Meta-Object Protocol*, can be; are; or were initially, built with of macros...

* Which compose IMHO by far the most advanced OO system programming has ever seen

Here's an example of a pretty awesome use of scheme macros to create efficient robotics systems written in scheme

Check one of my favorites implementations of a REST API: the Slack api client, that isn't written in Scheme but it is in Racket.

octotep/racket-slack-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!