architectures for organizing grammars

[email protected] (Aamer Akhter) Thu, 13 May 2004 15:12:51 -0400
Newsgroups perl.recdescent
Message-ID <[email protected]>
Hello,

This is really an open-ended question... and I pre-apologize for my rambling style.

So far all the examples of grammars I've seen are free standing on their own. 
We're eval'ing prd for providing xmlization services for a lot of varied output. 
It'll be mostly router output (from a variety of differently formatted 
commands), but could also be from unix boxes (eg, ifconfig, route).

Obviously, it doesn't scale to have the grammars for all the stuff described 
above in single prd parse instance. It'll take forever to compile for a single 
change , and simple changes in one command could break multiple commands all in 
one go. There's also the problem of easily distributing the commands as atomic 
grammars.

I'm curious how people have approached this problem. I'm currently thinking each 
  output's grammar is 'freestanding' (it may pull in tokens from a 
commonlibrary), and will be pre-compiled, and saved.  But each freestanding 
'parser' that is created needs to provide some kind of introspection (once 
loaded about what kind s of commands it can process). Also, there needs to be 
some kind of searchable registry that can tell which parser can process what 
etc. Hopefully, I'm now the first one thinking along these lines...

aa