[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

XPath and Recursive Descent Parsers

Subject: XPath and Recursive Descent Parsers
From: martin@xxxxxxxx
Date: Thu, 10 Apr 2003 13:56:46 +0000 (GMT)
recursive descent parser
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.