8 Aug 2000 sethg   » (Observer)

Finally I have some time to work on the FrameMaker::Mif project again. To paraphrase Spock, I am trying to build a LL(1) parser with stone knives and bearskins.

  1. The first time I tried writing the MIF parser, I used the Parse::RecDescent module. Unfortunately, when I encountered bugs -- I don't know whether they were my bugs or the module author's -- I had trouble debugging it, because the data structures that Parse::RecDescent produces are large, hairy, and contain code references (which Data::Dumper doesn't print out).
  2. Then I wrote a yacc grammar and used the -P (if memory serves) switch on byacc to generate a y.tab.pl file. I got a bare-bones module working with that technique, but now I want to change the data structure that the parser generates, and since I am a Prisoner of Bill here, schlepping files to and from a Unix account every time I want to tweak the grammar is not my idea of a good time.
  3. Then I thought, aha, Perl now ships with all these funky XML modules -- I can just translate the MIF file into an XML-syntax file that has exactly the same abstract structure, and use the XML modules to read the file back in and play with it. This is beginning to look like more trouble than it's worth.
  4. So, I've been boning up on the Tiger Book, writing up grammars, and then working out the FIRST and FOLLOW sets. Eleven terminals, ten nonterminals, nineteen productions, nothing but paper 'n ink. (I oughtta be a good boy and write a script to check my math before I actually implement this thing, right?) If I code this and it works, then I'll probably just download Parse::RecDescent again and use it. If it doesn't work, at least I'll have a better chance of knowing why....

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!