Re: DSL with a grammar

2010-07-09 Thread Jeff Rose
Like some people mentioned, you can use a parsing library, but often times I don't think that's necessary if you are just creating a DSL. There are a couple of other strategies. One is you can use a series of nested macros that expand into a data structure. In this way your DSL will sort of

Re: DSL with a grammar

2010-07-09 Thread Nicolas Oury
And does anyone has tried to use parser combinators on the result of the reader, within a macro? On Fri, Jul 9, 2010 at 11:23 AM, Jeff Rose ros...@gmail.com wrote: Like some people mentioned, you can use a parsing library, but often times I don't think that's necessary if you are just creating

DSL with a grammar

2010-07-08 Thread Nicolas Oury
Dear all, I am trying to write a small Domain Specific Language using macro, and I want the syntax of the args of the macro to be somehow parsed and transformed. So, I have two questions: - Does anybody else does that? (except the infix calculus) Is there a generic method for doing it? Or even

Re: DSL with a grammar

2010-07-08 Thread Michael Gardner
On Jul 8, 2010, at 1:52 PM, Nicolas Oury wrote: I am trying to write a small Domain Specific Language using macro, and I want the syntax of the args of the macro to be somehow parsed and transformed. So, I have two questions: - Does anybody else does that? (except the infix calculus) Is

Re: DSL with a grammar

2010-07-08 Thread Nicolas Oury
Sorry, that's why I had quote around my parse. I meant, use clojure reader to take a sequence in a macro and then parse it for my own DSL. So I shouldn't need any help from the reader (even if having some metas with line and character attached to thing would help) I do not want to go the parser

Re: DSL with a grammar

2010-07-08 Thread Michael Gardner
On Jul 8, 2010, at 2:34 PM, Nicolas Oury wrote: Sorry, that's why I had quote around my parse. I meant, use clojure reader to take a sequence in a macro and then parse it for my own DSL. So I shouldn't need any help from the reader (even if having some metas with line and character

Re: DSL with a grammar

2010-07-08 Thread Richard Lyman
On Thu, Jul 8, 2010 at 1:34 PM, Nicolas Oury nicolas.o...@gmail.com wrote: Sorry, that's why I had quote around my parse. I meant, use clojure reader to take a sequence in a macro and then parse it for my own DSL. So I shouldn't need any help from the reader (even if having some metas with

Re: DSL with a grammar

2010-07-08 Thread joshua-choi
Consider using FnParse (http://github.com/joshua-choi/fnparse/tree/ develop). It's a pure Clojure parser combiner that is flexible in what tokens it accepts. You can use it to parse the symbol/list/etc. structures given to your macros into other forms. FnParse 3, the latest version, is currently