Ragnar, thanks for your kind words; I'm glad you're finding kern fun and 
useful.

The lexer module has parsers that take care of whitespace, and conveniences 
like parens, braces, comma-sep (and others) that shorten things. You might 
start with the namespace blancas.kern.lexer.basic and use similar functions 
as core (but without the star) like sym and token that handle whitespace 
(these functions parse and then consume any whitespace until the next 
char). 

Using some of the functions from that namespace, lines 93-102 may come down 
to:
(def ruby-attributes (braces (comma-sep ruby-attr-pair)))

Similarly, lines 64-69 could be:
(def html-attributes (parens (many html-attr-pair)))

just surround the values with (lexeme) to ignore whitespace: the defs for 
html-name, html-value, ruby-name, etc:
(def html-name (lexeme (<|> ...)))

That would reduce the checks for spaces in your (bind) sequences. Just 
experiment with these ideas and see if it gets simpler. Feel free to ask me 
any more questions.

On Thursday, February 7, 2013 2:35:02 AM UTC-8, Ragnar Dahlén wrote:
>
> Hi Armando,
>
> Thank you for your great work with this library! I don't have much 
> previous experience with parser combinators, but with your implementation, 
> and the wonderful documentation, I've had a lot of fun playing and learning.
>
> I've been hacking on a small project for implementing a subset of HAML for 
> Clojure, with the goal of using HAML instead of HTML for enlive templates. 
> It is very early days, but if you're interested, I'd be very happy for any 
> feedback on the parser, which uses kern. I've probably done a lot of stupid 
> stuff.
>
> Project:
> https://github.com/ragnard/hamelito
>
> Parser:
> https://github.com/ragnard/hamelito/blob/master/src/hamelito/parsing.clj
>
> Best regards,
>
> Ragnar
>
>
> On Monday, 21 January 2013 18:27:07 UTC, Armando Blancas wrote:
>>
>> Kern is a text-parsing library based on Parsec, the Haskell monadic 
>> combinators library. It is useful for parsing all kinds of text: data, 
>> program input, configuration files, DSLs, or a full-blown programming 
>> language.
>>
>> My main goal is, like the Self folks, the power of simplicity. In the 
>> ideal case the grammar is the implementation, but I'm OK with something 
>> close. Next comes performance, which appears to be fine with hot code but 
>> not great otherwise. Let me know and will see what I can do.
>>
>> https://github.com/blancas/kern
>>
>> The wiki has a user's guide, tutorials, and links to several samples; 
>> will be adding some more topics there. There's also a Codox API zip file 
>> available for download. Feedback, suggestions, requests, bug reports are 
>> all very welcome; please use the project wiki.
>>
>>

-- 
-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to