in reply to Block-structured language parsing using a Perl module?

I don't know how you'd qualify a "full-featured, block-structured language", but I've used Parse::RecDescent to write a parser for OWL Functional Syntax which is a language that has identifiers and structures which nest to arbitrary depths. (Here's an example.)

The grammar is in RDF::Trine::Parser::OwlFn::Grammar; a pre-compiled version of the grammar (compiled by Parse::RecDescent) is at RDF::Trine::Parser::OwlFn::Compiled; the class RDF::Trine::Parser::OwlFn provides the end-user API for it.

Also of interest might be CSS::Parse::Heavy/CSS::Parse::Compiled.

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
  • Comment on Re: Block-structured language parsing using a Perl module?

Replies are listed 'Best First'.
Re^2: Block-structured language parsing using a Perl module?
by BrowserUk (Patriarch) on Aug 18, 2012 at 18:33 UTC

    Thank you tobyink. Those are both fine examples of the information I was looking for.

    (It's a shame that the metacpan site sends my browser (Opera) off into la-la land, but that's not your problem :)

    For me, the most telling files are the "compiled" grammars: OwlFn & CSS.

    I realise these are generated files, but damn are they ever resource hungry. It is no wonder that P::RD is so slow. Dog-forbid that either of you authors ever has to go plugging around inside there in order to solve a problem.

    Have you ever had occasion to measure the performance of your parser? (Do OwlFn source files ever get big enough that it is a concern?)


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    The start of some sanity?