Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tonyg/racket-auxiliary-macro-context
Syntactic extensibility outside expressions.
https://github.com/tonyg/racket-auxiliary-macro-context
macros match-expanders racket
Last synced: 5 days ago
JSON representation
Syntactic extensibility outside expressions.
- Host: GitHub
- URL: https://github.com/tonyg/racket-auxiliary-macro-context
- Owner: tonyg
- License: other
- Created: 2016-07-23T18:07:07.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-12-14T21:54:33.000Z (about 2 years ago)
- Last Synced: 2024-12-03T08:07:42.603Z (2 months ago)
- Topics: macros, match-expanders, racket
- Language: Racket
- Size: 18.6 KB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
# Syntactic extensibility outside expressions
Racket's macro system only expands forms in *expression* position by
default.However, certain DSLs within Racket, notably
[`match`](http://docs.racket-lang.org/reference/match.html), provide
hooks for defining macros that are expanded in DSL-specific contexts.
In the case of `match`, one may define
[match expanders](http://docs.racket-lang.org/reference/match.html#%28part._.Extending_match%29)
which allow abstraction over match patterns.This package provides a form `define-auxiliary-macro-context`, with an
implementation based on that of match expanders, which allows
convenient definition of new kinds of macro expansion contexts. In
principle, match expanders could be defined in terms of
`define-auxiliary-macro-context`.Potential uses include:
- defining one's own pattern language, complete with match-expander
style macros for extending the pattern syntax- defining a new kind of `lambda`, whose binding specification form
is extensibleToy/testing examples of the use of `define-auxiliary-macro-context`
can be found in
[`auxiliary-macro-context/test/`](auxiliary-macro-context/test/).A real-world example can be found in the implementation of the
pattern-language over assertions in
[Syndicate](https://github.com/tonyg/syndicate/).# Installation
Install via the package catalog,
raco pkg install auxiliary-macro-context
Alternatively, check out the repository and, in the directory
containing `Makefile`,make link
or
raco pkg install --link -n auxiliary-macro-context `pwd`
# Licence
Copyright © 2016, 2022 Tony Garnock-Jones
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.You should have received a copy of the GNU Lesser General Public
License along with this program (see the files "lgpl.txt" and
"gpl.txt"). If not, see .