Note that there are some explanatory texts on larger screens.

plurals
  1. POSteps and involvement of implementing a parser (in .Net - and in this case XPath 2.0)
    text
    copied!<p>In the lack of any good free XPath 2.0 implementations for .Net build upon Linq to XML I have thought about implementing my own (also for the experience). But just to be clear (and not building something that exists) these are the XPath 2.0 implementations I have found:</p> <ul> <li>Saxon .Net</li> <li><a href="http://qm.codeplex.com/" rel="nofollow noreferrer">Query Machine</a> - I had problems with this - exceptions with the examples</li> <li><a href="http://xqsharp.com/xqsharp/" rel="nofollow noreferrer">XQSharp</a> - may be good, but is commercial (single developer ~300 $)</li> </ul> <p>Now, I want some thoughts on how difficult it is to implementing some language such as XPath 2.0 expressions. I have found this link which have a EBNF for XPath 2.0 expression: <a href="http://www.w3.org/TR/2007/REC-xpath20-20070123/#id-grammar" rel="nofollow noreferrer">http://www.w3.org/TR/2007/REC-xpath20-20070123/#id-grammar</a> and I'm thinking of making it in F# with the fslex/fsyacc combination.</p> <p><strong>My background</strong> (subjective): I have played with these tools before, but only for some simple expressions and a very simple programming language. Furthermore, I have read most of the Dragon book and Appel´s Modern compiler implementation in ML - but unfortunately, I have not put the theory in practice while reading. I've studied computer science in a year now where I have completed courses with theory about ex <code>finite automaton</code>, <code>CFL</code> and algorithms but I have been a developer for years before university (a few years with professional jobs - back-end of websites mainly).</p> <p>Now, the steps of parsing and what I tend to cover:</p> <ol> <li>Lex - Parsing - Reductions: FsLex/FsYacc. I will properly not cover ALL of Xpath 2.0 at first but at least all of what XPath 1.0 can do + a little more.</li> <li>Sematic analysis - I'm not sure about how much there is to this</li> <li>Optimization - I do not tend to cover this (at least not at first)</li> <li>Actual traversing etc.</li> <li>...?</li> </ol> <p>Now, the <strong>concrete questions</strong> in addition to the above:</p> <ol> <li>How difficult is it to make a parser of this size? based on my background, would I could to it?</li> <li>Is there any crucial steps I have missed in regards to XPath 2.0 in particular?</li> <li>Is there any technology I have missed; Do I have to cover more than just XPath 2.0 and <code>XDocument</code> etc. to be able to make the parser?</li> </ol> <p><strong>To be clear:</strong> I want to make a XPath 2.0 expression parser and traverse <code>XDocument</code> etc. with this parsed expression. Which I guess combined is a query engine.</p> <p><strong>Update:</strong> I found this: <a href="http://www.w3.org/2007/01/applets/xpathApplet.html" rel="nofollow noreferrer">http://www.w3.org/2007/01/applets/xpathApplet.html</a> which contains code to parsing and traversing. I think it would be a nice start or reference :-)</p> <p>Your answers will be appreciated.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload