In this particular case, I wanted something that would work specifically on
strings of Clojure code rather than on forms directly. I could obviously go
from the former to the latter but I had hoped to avoid the use of
read-string in this case as well.

Tbh, I've also found c.t.a. to be a little intimidating in the past, though
given what I know now it might be a good time to return to the project to
take a look at what it has to offer some of my other projects.

On Tue, Aug 18, 2015 at 9:21 AM, Aaron Cohen <aa...@assonance.org> wrote:

> I'm curious why you chose to write your own parser rather than use
> clojure.tools.analyzer <https://github.com/clojure/tools.analyzer>?
>
> On Tue, Aug 18, 2015 at 10:53 AM, W. David Jarvis <venant...@gmail.com>
> wrote:
>
>> Hey all -
>>
>> I'm happy to announce the release of version 0.1.2 of Glow
>> <https://github.com/venantius/glow>, the syntax highlighting library I
>> open-sourced about a month ago.
>>
>> This release comes with a number of massive changes as to the underlying
>> nature of the library. In essence, I've moved away from a
>> regular-expression driven approach in favor of using a lexical parser to
>> build up a parse tree from the input string, which is then transformed into
>> a syntax-highlighted string.
>>
>> This has two advantages. First, it avoids a major problem I was having
>> with the regular expression approach in the form of a StackOverflowError
>> when attempting to identify long string literals within the input string.
>> Second, it produces an intermediate parse tree which can be transformed
>> using fairly standard Instaparse transformations to achieve arbitrary
>> formatting output (handy if, for instance, one wanted to produce HTML
>> output or hiccup templates).
>>
>> It has some disadvantage as well. It's somewhat slower, though I believe
>> the code to be more maintainable and comprehensible. It also requires the
>> input source code to be valid and parseable Clojure code, which you can
>> think of as either an advantage or a disadvantage :P
>>
>> Although I had hoped initially to use Instaparse for the project's
>> parser, I ended up getting considerably better performance from ANTLR /
>> clj-antlr, and so that's the path I've gone down. You can take a look at
>> the ANTLR Clojure grammar Glow uses here
>> <https://github.com/venantius/glow/blob/master/resources/parsers/Clojure.g4>
>> - I believe it to be comprehensive, and it handles a number of edge cases
>> that the grammar in the main ANTLR grammar repo does not.
>>
>> As always, I hope you get some usage out of this, and please do files
>> issues, PRs, etc (project page: https://github.com/venantius/glow) - or
>> just tweet at me @venantius <https://twitter.com/venantius>.
>>
>> Cheers,
>>
>>  - V
>>
>> --
>> 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/d/optout.
>>
>
> --
> 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 a topic in the
> Google Groups "Clojure" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/clojure/MDS961nvpFE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
============
venanti.us
203.918.2328
============

-- 
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/d/optout.

Reply via email to