Re: Lexer and parser generator in Clojure

2012-05-22 Thread Lukas Domagala
you could try https://github.com/Cyrik/clparsec . i´m still working on an alpha release, but it already has all the basic parsec operators -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com

Re: Lexer and parser generator in Clojure

2012-05-20 Thread Christophe Grand
On Sat, May 19, 2012 at 9:44 PM, Jason Jackson jasonj...@gmail.com wrote: In retrospect, I would have tried https://github.com/cgrand/**parsleyhttps://github.com/cgrand/parsley afaik it has ~LR1 performance characteristics. Parsley is closer to LR(0) (but I'd like to make it LR(1) using

Re: Lexer and parser generator in Clojure

2012-05-20 Thread Jason Jackson
This is a really great project. If you add LR1, you may want to retain ~LR0 as an option. My understanding is most grammars today are designed for LALR1. On Sun, May 20, 2012 at 4:26 AM, Christophe Grand christo...@cgrand.netwrote: On Sat, May 19, 2012 at 9:44 PM, Jason Jackson

Re: Lexer and parser generator in Clojure

2012-05-19 Thread Matt Mitchell
Here's a parser: https://github.com/joshua-choi/fnparse Doesn't look like it's active, but could be a starting point? - Matt On Friday, May 18, 2012 8:46:19 AM UTC-4, Alexsandro Soares wrote: Hi, I'm trying to build a compiler using Clojure. Is there any tools like flex and bison

Re: Lexer and parser generator in Clojure

2012-05-19 Thread John Szakmeister
On Fri, May 18, 2012 at 8:46 AM, Alexsandro Soares prof.asoa...@gmail.com wrote: Hi, I'm trying to build a compiler using Clojure. Is there any tools like flex and bison generating Clojure code? I'm interested in a lexer/parser in pure Clojure because I think  in use the same code

Re: Lexer and parser generator in Clojure

2012-05-19 Thread Jason Jackson
I wrote a compiler in Clojure for a 4th year course. For parsing I used this combinator parser library: https://github.com/jasonjckn/clarsec which is modeled after haskell's parsec. However the performance was kind of bad, combinator parsers in general can be pretty slow. In retrospect, I

Re: Lexer and parser generator in Clojure

2012-05-19 Thread Jason Jackson
I didn't read the part about clojure/clojurescript interop. Also, you could write a parser by hand in clojure[script], which takes a parse table as input. The parse table can be generated with from any language. On Saturday, 19 May 2012 15:44:28 UTC-4, Jason Jackson wrote: I wrote a

Re: Lexer and parser generator in Clojure

2012-05-19 Thread Brent Millare
I wrote a library on parsing expression grammars (PEGs). Its not completely independent from clojurescript since I use java's regular expressions for the token component, but technically it works on sequences and its easy to rewrite this for js's regexps. Performance hasn't been measured but

Lexer and parser generator in Clojure

2012-05-18 Thread Alexsandro Soares
Hi, I'm trying to build a compiler using Clojure. Is there any tools like flex and bison generating Clojure code? I'm interested in a lexer/parser in pure Clojure because I think in use the same code with Javascript (via ClojureScript) and Java (via Clojure). I already know isolated

Re: Codox: an API doc generator for Clojure

2012-01-04 Thread Fogus
It might be an idea to figure out some standard syntax we could use, like Markdown, that could be used for formatting docstrings. My vote is for Markdown as well. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Codox: an API doc generator for Clojure

2011-12-27 Thread Tom Faulhaber
Hi All, This makes me feel quite embarrassed that autodoc hasn't seen a release for non-core/contrib projects in so long. I apologize for that. (Insert all the usual life has been crazy... caveats here.) I hate seeing smart people having to recreate stuff just cause it's taking me a long time to

Re: Codox: an API doc generator for Clojure

2011-12-27 Thread Stefan Kamphausen
Hi, On Tuesday, December 27, 2011 1:18:52 PM UTC+1, James Reeves wrote: It might be an idea to figure out some standard syntax we could use, like Markdown, that could be used for formatting docstrings. IMHO the missing homoiconicity of docstrings in all flavors of Lisp that I worked with

Re: Codox: an API doc generator for Clojure

2011-12-27 Thread James Reeves
On 26 December 2011 21:23, Gert Verhoog m...@gertalot.com wrote: Question: One of my ns docstrings is a fair amount of text which is rendered as a really long line (because codox puts it inside a pre.../pre element). How would you deal with longer documentation strings? Would I need to

Re: Codox: an API doc generator for Clojure

2011-12-27 Thread Laurent PETIT
Hello, Is it in your roadmap to provide links to source code of the functions ? I know this is a border line feature between codox/autodoc and marginalia, but it could be proven useful, even for API documentation (no API is perfectly documented) 2011/12/26 James Reeves jree...@weavejester.com

Codox: an API doc generator for Clojure

2011-12-26 Thread James Reeves
Hi folks, In order to generate the documentation for Ring and Compojure, I created Codox after being unable to get Autodoc working. Codox is pretty simple, but should work out of the box, and hopefully looks quite nice. Here are a couple of examples: http://mmcgrana.github.com/ring/

Re: Codox: an API doc generator for Clojure

2011-12-26 Thread Shantanu Kumar
+1 This is pretty neat! (I too couldn't get Autodoc working in the past several months.) Regards, Shantanu On Dec 26, 10:29 pm, James Reeves jree...@weavejester.com wrote: Hi folks, In order to generate the documentation for Ring and Compojure, I created Codox after being unable to get

Re: Codox: an API doc generator for Clojure

2011-12-26 Thread Gert Verhoog
I love it, thanks, and I got it running in about 10 seconds: lein install plugin codox 0.3.1 lein doc Question: One of my ns docstrings is a fair amount of text which is rendered as a really long line (because codox puts it inside a pre.../pre element). How would you deal with longer

Re: Codox: an API doc generator for Clojure

2011-12-26 Thread Meikel Brandmeyer
Hi, Am 26.12.2011 um 22:23 schrieb Gert Verhoog: Question: One of my ns docstrings is a fair amount of text which is rendered as a really long line (because codox puts it inside a pre.../pre element). How would you deal with longer documentation strings? Would I need to insert manual line

Re: generator in Clojure

2010-10-17 Thread clwham...@gmail.com
I don't actually 'know' that I need a function that relies on mutable state, I'm really just trying to understand how to do what I want using the functional paradigm. I'm writing a data generator which creates CSV files to be uploaded to a test database. I'm simulating the behavior of some

Re: generator in Clojure

2010-10-15 Thread Konrad Hinsen
On 14 Oct 2010, at 21:52, clwham...@gmail.com wrote: I need a function that produces the 'next' value from a lazy-seq -- something like a Python generator. I imagine it would have to be some sort of closure like: (def next-sine (let [sines (atom (cycle (map sin (range 0 6.28 0.01]

generator in Clojure

2010-10-14 Thread clwham...@gmail.com
I need a function that produces the 'next' value from a lazy-seq -- something like a Python generator. I imagine it would have to be some sort of closure like: (def next-sine (let [sines (atom (cycle (map sin (range 0 6.28 0.01] #(swap! sines rest))) Is there a more idomatic way

Re: generator in Clojure

2010-10-14 Thread Moritz Ulrich
Are you sure you need to capture the state in next-sine? It's not very clojure-ly to have functions with state. I would capture the state in the caller as an integer and just use get or nth on the lazy seq. If you want to stick to your impure function, please mark it with a ! at the end:

Re: generator in Clojure

2010-10-14 Thread Nicolas Oury
(defn iterate [s] (let [a (atom s)] (fn [] (let [s @a] (reset! a (next s)) (first s)) but it's not very idiomatic in clojure. (In Lisp it is traditional to hide a state in a closure. A lot of toy object language work like that) On Thu, Oct 14, 2010 at

Re: generator in Clojure

2010-10-14 Thread clwham...@gmail.com
I originally thought of calling nth on the seq but isn't that pretty wildly inefficient? On Oct 14, 1:38 pm, Moritz Ulrich ulrich.mor...@googlemail.com wrote: Are you sure you need to capture the state in next-sine? It's not very clojure-ly to have functions with state. I would capture the

Re: generator in Clojure

2010-10-14 Thread Alan
Yes, it would be. But it's wildly unlikely that you need to do it. You don't say what you're using next-sine! for, but I'll imagine you're doing something like printing it. Maybe your code looks like: (dotimes [n num-iters] (let [s current-sine] (next-sine!) (println s))) This can

Converting a AS3 Cave Generator to Clojure

2010-08-05 Thread msappler
Hi I am having trouble with converting this cave generator to clojure. Basically how would you implement the generateCave method with pop and push in a functional style? Here is a description to the algorithm: http://properundead.com/2009/03/cave-generator.html And here you can download the AS3