Reputation: 487
I want to parse XPath expressions I an looking for a lexer/parser implementation in C++ or Python
Here is all the information about XPath parsers I manage to gather :
Does anyone knows other implementations ? in C++ ?
PS : I don't want to evaluate XPath expressions but to tokenise them
Upvotes: 1
Views: 3203
Reputation: 95420
Based on a comment by OP,
I am working on XPath queries rewriting and equivalence
what he needs is a parser that builds abstract syntax trees, and ways to analyze those trees and transform them. Analyzers and "rewriting" can then be done procedurally by walking/modifying the AST; this is the traditional way to do it.
But it seems that the focus should be OP's goals. For that he needs analysis and rewriting. But that doesn't have to be entirely done in the traditional, procedural way. Rather, it would be nice if the analysis/rewrites can be done directly using XPath notation.
I suggest he look at our DMS Software Reengineering Toolkit which parses, builds ASTs, but in particular enables "rewriting" on the ASTs using the surface syntax. Then XPath "rewrites" could be written directly as equivalences over XPath expressions. A motivating example of how this works can be seen as Rewriting algebra equations using DMS. It should be obvious from that example that a grammar for XPath is easily defined.
Upvotes: 2
Reputation: 264689
Xerces has an offshoot, xalan-c, for doing this:
http://xml.apache.org/xalan-c/overview.html
Upvotes: 0