Hello Liam I'm neither an expert on this subject. :) Nevertheless I'll give you my position.
Defining a new language, formally speaking, is very hard: you have to define new symbols and rules. On many languages the same token can be used in different contexts (think of "{" on Java: if blocks, method blocks, class blocks: here the word "block" means very different things). If you're going to write by hand you'll have to check all these contextual points, and finally handle the validation process of the source file as a whole. Tools as ANTLR give you the chance to just specify the grammar (allowed symbols and rules), leaving to them all the validation checks. You can also give them a grammar and a set of events (called "template" in ANTLR), which are automatically triggered by the parser when it processes a given rule. So this is the reason, in my opinion, of why the "by hand" way is not very used. This topic is related to (external) Domain Specific Languages, so maybe you can find interesting this: http://martinfowler.com/articles/codeGenDsl.html#UsingTemplatesForGeneration. Ciao Roberto On Fri, Jan 29, 2010 at 4:59 AM, Liam <liam.ga...@gmail.com> wrote: > Could someone educate me about what developers normally do when faced > with having to create a lexer / parser / analyzer, say for clojure? > > Why would people go with a canned solution, i.e. ready-made like soup > out of a can, instead of by hand? > > E.g. why did the Counterclockwise Eclipse plug-in for Clojure use > ANTLR , or why did in the Enclojure NetBeans plug-in for clojure use > JFLEX? Why in clojure itself is there a reader made by hand and not > using a canned generator? > > Am I naive in thinking one should do that by hand? Is this archaic > thinking like those who still prefer building websites in HTML by > hand? > > What's the advantage of doing that, say for clojure or in general? You > still have to learn how a given generator works. And you may be > limited by its design. What if you want fine combed control over how > things are parsed to get, for example, sophisticated syntax based > evaluation or inferences from cold code. E.g. like what Eclipse does > for Java and their “Java Models” and exhaustive “Abstract Syntax Tree” > nodes? > > I hope some of you could be generous enough to enlighten me. > > -- > 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 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