I enjoyed working with clj-antlr recently, it's a wrapper over a java library, but gives you a fast feedback loop with an interpreter instead of generated java code. The 'clojurey' part is that the output is a nested sequence, from there it's really effective to use tree zippers and core.match to transform the parse-tree into the data structure you need.
Take a look at: https://github.com/clojure/core.match https://github.com/aphyr/clj-antlr https://www.ibm.com/developerworks/library/j-treevisit/ https://github.com/akhudek/zip-visit On Tue, Aug 15, 2017 at 9:56 AM Laurens Van Houtven <_...@lvh.cc> wrote: > Hi, > > > Instaparse is a great parser generator, especially if you already have a > BNF. > > Sent from my iPhone > > On Aug 15, 2017, at 08:44, sventrax...@gmail.com wrote: > > Thanks for your input. LFE is quite an unexpected "thing". > > What I'm trying to do, is just a "lunch time project"; something that I > can target without corporate constrains just as a learning exercise. > Furthermore I can test the Clojure version against my old working Java > version. > > As I was saying, while experimenting with Instaparse, I'm having the > feeling it is not the correct Clojure tool for this type of development > > > > On Tuesday, August 15, 2017 at 2:17:50 PM UTC+1, adrians wrote: >> >> If you need the features of Erlang but would like that in a Lisp (not >> Common Lisp, though) environment, have you taken a look at LFE (Lisp >> Flavored Erlang)? I'm not trying to discourage you from looking at Clojure, >> but if you need/depend on some of the features of Erlang, LFE might be a >> closer fit. >> >> http://lfe.io >> >> On Tuesday, August 15, 2017 at 8:11:53 AM UTC-4, svent...@gmail.com >> wrote: >>> >>> >>> Hi >>> >>> Months ago I read a review that praised Clojure's clean approach and use >>> of JVM that is almost always available in my deployments. >>> >>> My background: started with 370 assembly ( so I'm not young!!!) and >>> during the last four years I've been using Erlang for network applications. >>> For my type of work the functional approach, concurrency and bit handling >>> of Erlang are life savings. Nonetheless I feel "the call" of Clojure. As an >>> exercise I would like to re implement something I did years ago in Java, >>> i.e. a sort of parser. What I have on my hands is a DSL like this >>> >>> HeaderRule=hr-ftp >>> Term=100 >>> name="ftp" >>> From=1 >>> networkPort="21" >>> Protocol=1 >>> Tcp=1 >>> up >>> up >>> up >>> Then=1 >>> ProtocolInspection=1 >>> ftpRuleSet="frs-ftp" >>> up >>> ServiceDataFlowId=1 >>> payload=99 >>> up >>> up >>> up >>> up >>> HeaderRule=hr-http >>> ...... >>> >>> For my old Java implementation I used state machines to build an >>> internal representation, sort of an AST, that would be used to analyze pcap >>> files. In my Clojure challenge, I would like to have a different approach. >>> Googling around I've found many options: Parsley, Instaparse, cljcc and >>> more. Some mentioned on www.clojure-toolbox.com seem to be more >>> abandonware. >>> At the moment I'm focusing on Instaparse. However, maybe due to the >>> previous implementation, I feel that this is not the best approach with >>> Clojure. Certainly my rookie state is leading me the wrong way. >>> >>> Comments and feedback will be greatly appreciated >>> >>> Fred >>> >>> >>> >>> >>> >>> -- > 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 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 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.