Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Object Query Languages and Parsers

by kvale (Monsignor)
on Apr 21, 2006 at 21:54 UTC ( #544990=note: print w/ replies, xml ) Need Help??


in reply to Object Query Languages and Parsers

Regarding object query langugages, you might look at the CORBA system. As an object request broker, it needs to be fast, so the syntax is pretty simple. Of course, it may be too low level, but will give you ideas.

With regard to parsing, I would first create a grammar. I find Parse::RecDescent too slow when speed is of the essence. Writing your own top-down parser should speed things up and for a small grammar, it should be be easy to maintain as well.

Top-down parsers are constructed from a grammar as follows:

  • Each nonterminal in your grammar becomes a subroutine that you call
  • Alternation '|' is handled with if-then statments
  • Qunatifiers like '*' and '+' are handled with loops
  • Nonterminal strings are matched using regexes.
For learning about parsing and translation, I recommend the dragon book: Compilers, by Aho, Sethi, and Ullman.

-Mark


Comment on Re: Object Query Languages and Parsers

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://544990]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2014-12-23 05:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (135 votes), past polls