ANN: syntax-rules

103 views
Skip to first unread message

Brian Goslinga

unread,
Jan 2, 2011, 2:57:41 PM1/2/11
to Clojure
I have released version 1.0.0-alpha1 of my syntax-rules library:
http://clojars.org/org.clojars.qbg/syntax-rules. This library is also
on Github: https://github.com/qbg/syntax-rules

This library seeks to address two sources of incidental complexity
when writing macros in Clojure using defmacro: parsing the macro form
and checking for syntax errors. The library provides powerful tools
for parsing macros with complex syntax (see the wiki for an example of
parsing deftype). In addition, this library will generate reasonable
syntax error messages almost for free.

The wiki for this library is located at https://github.com/qbg/syntax-rules/wiki.
On the wiki are some simple examples comparing the implementation of
simple macros from Clojure using defmacro and defsyntax-rules. An
implementation of defn is provided using defsyntax-rules. As mentioned
above, there is also an example of parsing deftype using defsyntax-
rules.

I hope people find this library useful.

Brian

Sunil S Nandihalli

unread,
Jan 3, 2011, 12:29:18 AM1/3/11
to clo...@googlegroups.com
really nice .. I used to wonder why nobody had already written something like this for clojure.. after I found out that scheme had all this.. Will definitely check it out.. :)
Sunil.

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Konrad Hinsen

unread,
Jan 3, 2011, 2:48:43 AM1/3/11
to clo...@googlegroups.com
On 2 Jan 2011, at 20:57, Brian Goslinga wrote:

> I have released version 1.0.0-alpha1 of my syntax-rules library:
> http://clojars.org/org.clojars.qbg/syntax-rules. This library is also
> on Github: https://github.com/qbg/syntax-rules

Excellent, thanks! Ever since I saw a paper on syntax-rules in Scheme
I have wanted this for Clojure.

Konrad.

Mark

unread,
Jan 3, 2011, 8:44:14 AM1/3/11
to Clojure
One of the stmbling blocks I find as a Clojure newbie are syntax
errors working with core library macros. The error messaeges aren't
always descriptive. What are the chances that core macros could be
rewriiten using a future version on defsyntax to help with this
problem?

On Jan 2, 11:57 am, Brian Goslinga <quickbasicg...@gmail.com> wrote:
> I have released version 1.0.0-alpha1 of my syntax-rules library:http://clojars.org/org.clojars.qbg/syntax-rules. This library is also
> on Github:https://github.com/qbg/syntax-rules
>
> This library seeks to address two sources of incidental complexity
> when writing macros in Clojure using defmacro: parsing the macro form
> and checking for syntax errors.  The library provides powerful tools
> for parsing macros with complex syntax (see the wiki for an example of
> parsing deftype). In addition, this library will generate reasonable
> syntax error messages almost for free.
>
> The wiki for this library is located athttps://github.com/qbg/syntax-rules/wiki.

Brian Goslinga

unread,
Jan 3, 2011, 10:38:33 AM1/3/11
to Clojure
On Jan 3, 7:44 am, Mark <markaddle...@gmail.com> wrote:
> One of the stmbling blocks I find as a Clojure newbie are syntax
> errors working with core library macros.  The error messaeges aren't
> always descriptive.  What are the chances that core macros could be
> rewriiten using a future version on defsyntax to help with this
> problem?
There would be a bootstrapping problem involved if such a transition
would happen as the macros needed to define the functions and macros
used by the library need to be defined before the library is able to
define other macros. The problem is in theory solvable: use the
current versions as bootstrapping versions then redefine them once
library is usable. However, this solution would involve code
duplication which is not desirable. One could also give up the ability
to bootstrap the language, but IMO that would be worse than the code
duplication.

Brian
Reply all
Reply to author
Forward
0 new messages