Last week readers helped me with this interesting question of parsing
a formal language (specifically XPath) in XSLT. A couple of you (John
L, Christophe) pointed me to Gunther Rademacher's awesome work on the
REx parser generator.
This is good stuff and I was indeed able to get XPath 2.0 parsing
running very readily. Fantastic!
What I haven't managed to do yet is get XPath 1.0 parsing.
For that, I need a formal grammar in EBNF that will work in Gunther's
tool. Conveniently, his other tool that draws railroad diagrams offers
one -- https://www.bottlecaps.de/rr/ui -- which indeed appears to be
pulled straight out of the XPath 1.0 Recommendation (see its initial
comment). Sounds good.
However, while it makes a pretty railroad diagram, this EBNF doesn't
work in REx. (There is no good reason to think, I suppose, that it
should, but it is hard not to hope. :-) Possibly it is only partial.
In any case I need either an EBNF that works, or an education, to
provide me with the skills to repair this one.
Do you have any helpful hints? What should implementers be looking at,
for formal descriptions of XPath 1.0 (assuming they want to do that
today, as I do)? In particular might there be somewhere a
complete-and-working variant of the XPath 1.0 grammar such as REx can
consume, or should it actually be pretty easy to make?
PS - If anyone wishes to try the XPath 1.0 EBNF I have copied down
(which does not work :-):
- REx parser generator: https://www.bottlecaps.de/rex/
- non-functioning EBNF:
Maybe it is not that far off. REx chokes on the production for "Literal".
Thanks ! wap
On Thu, Mar 26, 2020 at 7:16 PM Liam R. E. Quin liam(_at_)fromoldbooks(_dot_)org
On Thu, 2020-03-26 at 22:49 +0000, Christophe Marchand
I've used REx parser (exactly the URL mentioned by John) during XML
Prague to convert XQuery code into syntax hilighted code in slides,
for a XQuery course.
Yes - i used it in XSLT at one point for some simple XSLT coverage
checking. (perhaps i should talk about that a bit in the course on
Liam Quin, https://www.delightfulcomputing.com/
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Barefoot Web-slave, antique illustrations: http://www.fromoldbooks.org
...Wendell Piez... ...wendell -at- nist -dot- gov...
...wendellpiez.com... ...pellucidliterature.org... ...pausepress.org...
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com