[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] XPath and Recursive Descent Parsers
hi, has anyone tried using recursive descent to parse XPath expressions? I've written a recursive descent parser generator in XSLT, i want to generate an XPath parser, but wondering if i'm going to run into problems with my left-recursion eliminations. to avoid infinite recursion i've rewritten left-recursive rules, for example, from -> relativeLocationPath ::= step | relativeLocationPath '/' step | relativeLocationPath '//' step to -> relativeLocationPath ::= step relativeLocationPathRest relativeLocationPathRest ::= '/' step relativeLocationPathRest | '//' step relativeLocationPathRest | pretty standard. however, this will make the expressions right-associative instead of left, so i might end up with: <relativeLocationPath> <step/> <relativeLocationPath> <step/> </relativeLocationPath> <relativeLocationPath> etc instead of <relativeLocationPath> <relativeLocationPath> <step/> </relativeLocationPath> <step/> <relativeLocationPath> i'm not sure if this is really a problem for the semantic of the expressions though. just thought maybe someone's done this already and concluded it's not feasible, would save me a lot of trouble! cheers, /m Martin Klang http://www.o-xml.org - the object-oriented XML programming language XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|