pileofrogs has asked for the wisdom of the Perl Monks concerning the following question:

I have a crackpod idea for a markup language that's a combo of docbook and wiki. I like the idea of markup that describes the content rather than the look. I like the way wikis have super simple mark up.

So, before I get to the perl question, does this already exist?

Ok, onto the perl question. I'm obviously going to need to write a parser for my crackpod markup language. Rather than sit down and hack something up, I'd like to know a little more about doing something like this properly. I'd love any links to good resources talking about writing a parser, any perl modules that are good for this kind of thing, personal lessons learned writing a parser etc...

Thanks!
--Pileofrogs

Replies are listed 'Best First'.
Re: Writing a Wiki Parser
by jethro (Monsignor) on Jul 11, 2008 at 23:08 UTC
    First of all, what don't you like about the wiki languages. This is markup that describes content as far as I can tell

    A good simple parser module is Parse::RecDescent, I use it for a game management language. It has some rough edges. For example you should extract the perl code into subs instead of writing all in the parser because you otherwise get error messages with unusable line numbers. And I wouldn't use it for parsing complicated stuff like real computer languages, but for markup it should be good enough.

      Wikis (or at least the ones I've seen) describe how the document looks, eg __foo__ might mean underline foo.

      I want my markup to describe what the document says and later let my parser/processor implement the look. Then I get a consistent look, I can change it whenever I want and I can implement cool content related features, here's a pseudo code example.

      My favorite book is BOOK<Perl Programming>.  I also like BOOK<The Hobbit>.

      If I want to, I could render all book titles in bold, then I could later decide I want to render them in italics.I could put them in a list of all books mentioned in my document, I could make each book title include a link to Amazon... etc.. etc...

      You can do this with docbook, but it's a huge pain to actually write in. <document type=book link=true>The Hobbit</document> Note, that's not real docbook, but real docbook is that cumbersome.

Re: Writing a Wiki Parser
by tilly (Archbishop) on Jul 11, 2008 at 23:13 UTC
    Depending on what your markup looks like, you might get some interesting ideas about how to tackle this problem from Why I like functional programming. Or not - what is discussed there is rather different from any normal concept of a grammar or parsing.