Hi Everybody, https://gist.github.com/cced1cf377ed49005704 *instaparse_question.clj* <https://gist.github.com/anonymous/cced1cf377ed49005704#file-instaparse_question-clj> Raw <https://gist.github.com/anonymous/cced1cf377ed49005704/raw/220ff32218839db388261fd8e2489288a0093606/instaparse_question.clj> 12345678910111213141516171819202122232425
(ns lua-map-parser.instaparse-question (:require [instaparse.core :as insta])) (let [parser (insta/parser " lua-file = {map-decl|return-statement} map-decl = <'local'> identifier <'='> <'{'> { map-entry} <'}'> ; identifier = #'[a-zA-Z\\_][0-9a-zA-Z\\-\\_]*' ; map-entry = <'['> (string|number) <']'> <'='> (string|number) ; string = <'\\\"'> #'([^\"\\\\]|\\\\.)*' <'\\\"'> ; number = integer | decimal ; <decimal> = #'-?[0-9]+\\.[0-9]+' ; <integer> = #'-?[0-9]+' ; <return-statement> = <'return'> <identifier>" :auto-whitespace :comma)] (defn lua-map-parser [str] (parser str))) (lua-map-parser "local CTRData = { [1]=2 , [\"3\"]=4 } local MYData = { [\"hello\"] = \"world\" [\"sunil\"] = 1 [\"satish\"] = \"office\" [\"dad\"]=\"home\" } return CTRData ") The above grammar simply parses a map in lua-syntax. It works for the above case. However, when I try to use it on a file that is about 1 MB in size, it fails(not sure didn't wait longer than 2 minutes). I would love to hear if there is something that is grossly inefficient in the way I have represented my grammar. The lua interpreter loads the file in no time (well 0.06 sec) . I would love any feedback on improving the grammar. Thanks Sunil. -- 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.