Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

Ovid
  (email not shown publicly)
http://publius-ovidius.livejournal.com/
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Sunday February 06, 2005
02:52 PM

The parser that couldn't parse

[ #23052 ]

So I'm still trying to incorporate the XProlog work into my WProlog port. Unfortunately, while they're related, they certainly are not of the same species. I can't simply steal the shiny bits like I intended to. Part of the reason for this is XProlog's use of JavaCC. The latter tool is a type of compiler compiler. Given a grammar, it can write out a Java class that can compile code from said grammar.

I can try to just port it, but the code is very convoluted and will be very difficult to debug. Instead, since I already have a character-based parser, why not just use that? Well, AI::Prolog::Parser, based on the original parser code, can't parse much of anything. It mainly provides the tools for parsing. The AI::Prolog::Term and AI::Prolog::TermList classes know how to parse terms and term lists respectively. I suppose having classes know how to parse the bits of grammar they represent is understandable, but this means the parsing code is spread out over three classes and cannot get easily integrated back into the parse class (something XProlog requires.) However, XProlog has operators, uses less memory and runs faster. I have to move forward.

Now what the hell do I do? Do I try to fold those extra parsing bits back into the parser class? Do I switch to Parse::RecDescent or perl-byacc? None of these solutions sound appealing. Lots of work ahead of me. I have some ideas, but so far I've wasted about half of today on a failed approach.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.