in reply to Parsing a tree instead of a string?

Just a wild thought: did you think of XML, XSLT, XPATH and such?

The data model provides a tree representation of XML documents as well as atomic values such as integers, strings, and booleans, and sequences that may contain both references to nodes in an XML document and atomic values. The result of an XPath expression may be a selection of nodes from the input documents, or an atomic value, or more generally, any sequence allowed by the data model. The name of the language derives from its most distinctive feature, the path expression, which provides a means of hierarchic addressing of the nodes in an XML tree (found here)

CountZero

"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

  • Comment on Re: Parsing a tree instead of a string?

Replies are listed 'Best First'.
Re^2: Parsing a tree instead of a string?
by nothingmuch (Priest) on Jan 22, 2005 at 17:57 UTC
    XPath seems like a useful implementation for the patterns that the rules match. It's rather general and powerful, and I might eventually use it, but it has two problems, that cocnern me where I am now, and provides, as I see it, no solution for either:
    • XPath is not a grammer, it's a way to write patterns, so it will need to be part of a larger scheme
    • XPath will be very hard to performance-tune later. I will probably need to prune the very wide match tree to find the results I'm most happy with in a timely manner. I doubt XPath will let me do it since it's possibly a bit too powerful.
    The second problem is solvable provided I can ask per node whether rule $some_xpath_based_rule applies to it, and then memoize the results, but trying to find a good match by pruning, like game-playing searches do is not very trivial since it is rather closed.

    I think I may eventually use a subset of XPath, where some of it's aspects/features are actually pushed up to the grammer engine level, and at that point I might have something useful.

    Anyway, my answer is "yes, i've thought of that, but I'm not really sure what I'm going to do about those thoughts yet" ;-).

    Thanks for your time!

    -nuffin
    zz zZ Z Z #!perl