Hi Jeremy, Thank you for your suggestion, it's worth a try. It seems though that it might not be suitable for my more distant plans for this project, because:
1) The full Scribble syntax is not context-free: multiline text mode has to remember the starting indentation (although I'm not sure if this feature is necessary); 2) It would be very convenient to be able to write this pseudo-Scribble code with the full use of REPL, autocompletion etc (for example, in LightTable), and it requires a custom reader, and not just a separate parser. On Saturday, August 24, 2013 7:18:40 PM UTC+10, JeremyS wrote: > > Hi Bogdan, > > That's a cool Idea ! I'm wondering if you wouldn't be better off with > something like Instaparse <https://github.com/Engelberg/instaparse>. > > Cheers, > > Jeremys. > > On Friday, August 23, 2013 3:37:53 PM UTC+2, Bogdan Opanchuk wrote: >> >> Hi all, >> >> For those who are not familiar with Scribble, it is basically a >> preprocessor for Racket (a dialect of Lisp) which makes its syntax more >> concise when working with lots of text, effectively turning it into a >> template engine (see http://docs.racket-lang.org/scribble/reader.htmlfor >> details). TLDR: a very small subset of Scribble would transform >> >> @func{text text @other-func{more text} final words.} >> >> to >> >> (func "text text " (other-func "more text") " final words.") >> >> I would like to implement it in Clojure as a learning project (say, the >> simple subset of it shown above, for a start). My question is, what should >> I use? Let's say for simplicity that the entry point is some function >> (load-file-scribble "filename.scribble") that returns Clojure code same as >> (load-file "filename.clj") does. As far as my general understanding of >> programming languages goes, I have to: >> >> 1. extend the tokenizer to support additional syntax; >> 2. extend the parser (?) to convert the new tokens into corresponding >> Clojure tokens; >> 3. feed the result to the Clojure parser >> >> (although I might be completely wrong). >> >> There is the ``tools.reader`` module, which seems more or less suitable, >> but I cannot find the hooks that would allow me to extend its functionality >> in the required way. Is it the right tool, or should I look some other way? >> >> >> > -- -- 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.