nothingmuch has asked for the wisdom of the Perl Monks concerning the following question:
It involves taking matches against tree data (that's not too hard to define, it's just regexes with different primitives), and evaluating them on points in the tree (a bit harder?) but not as matches, but as a grammer. The whole thing must be a true parsing solution, that is able to give back twigs of the tree that have matched. This involves backtracking, and nesting, and so on.
On the CPAN there's Data::Match, which seems primitive and unflexible, and a plethora of parsing solutions, which seem very potent, but suited towards strings. For the matching part, I might try to base around Data::Compare which I know and like, but as for the parsing I really don't know...
Is anyone familiar with a parser module to an extent where they can say whether the code can be hijacked to the point that the matching itself, aswell as the input gathering is easily replaceable (that is, the atoms of the grammer and what they are willing to match is my own concern), without having to reimplement the rule composition, backtracking, permuting, and reporting?
Lastly, I would like to be able to prune the search tree based on heuristics. The data can be matched in many ways, i'm concerned about finding one which is good enough, given a user threshold.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Parsing a tree instead of a string?
by CountZero (Bishop) on Jan 22, 2005 at 13:15 UTC | |
by nothingmuch (Priest) on Jan 22, 2005 at 17:57 UTC | |
|
Re: Parsing a tree instead of a string?
by mirod (Canon) on Jan 22, 2005 at 14:17 UTC | |
|
Re: Parsing a tree instead of a string?
by ihb (Deacon) on Jan 22, 2005 at 16:55 UTC | |
by nothingmuch (Priest) on Jan 23, 2005 at 09:55 UTC | |
|
Re: Parsing a tree instead of a string?
by ysth (Canon) on Jan 23, 2005 at 09:33 UTC | |
by nothingmuch (Priest) on Jan 23, 2005 at 09:58 UTC |