The Choice of Recursive Descent Parser?
Added by Anonymous over 19 years ago
Legacy ID: #3145344 Legacy Poster: ali (cfsdevln)
Dear Michael, I believe that the XQuery Parser that you have used in Saxon is a recursive descent parser, right? Would you be kind enough to explain why you chose to implement the XQuery Parser as a recursive descent parser? Thanks Regards, Ali
Replies (1)
RE: The Choice of Recursive Descent Parser? - Added by Anonymous over 19 years ago
Legacy ID: #3145520 Legacy Poster: Michael Kay (mhkay)
The first version of Saxon's XPath 1.0 parser was copied from James Clark's xt product; I didn't choose to design a recursive descent parser, I chose to reuse an existing component that did the job required. (In fact, at that time it was only a subset of XPath 1.0). Since then it has just grown. While it was probably a reasonable choice for XPath 1.0, the XQuery syntax is really a bit too large for this technique to be comfortable. However, it does give a lot more control than some other techniques: given the strangeness of the XQuery grammar, with the differences in tokenization rules between different parts of the syntax, a hand-written parser makes it a lot easier to handle the state changes. And I wouldn't attempt writing any other kind of parser by hand. Meanwhile it's simply been a case of "it ain't broke so don't fix it". Michael Kay
Please register to reply