步骤和实施解析器(在.net - 在这种情况下的XPath 2.0)的参与 [英] Steps and involvement of implementing a parser (in .Net - and in this case XPath 2.0)

查看:209
本文介绍了步骤和实施解析器(在.net - 在这种情况下的XPath 2.0)的参与的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在缺乏任何好的免费的XPath 2.0的实现净建立在LINQ的到XML我曾经想过实现我自己的(也为经验)。但仅仅是明确的(而不是建造的东西存在的话),这些都是XPath 2.0中实现,我发现:

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:

  • 萨克森净
  • 查询机 - 我有问题,这 - 例外的例子
  • XQSharp - 可能是好的,但商业(单个开发者〜$ 300)
  • Saxon .Net
  • Query Machine - I had problems with this - exceptions with the examples
  • XQSharp - may be good, but is commercial (single developer ~300 $)

现在,我想它是实现一些语言例如XPath 2.0 EX pressions多么困难的一些想法。我发现这个链接,有一个EBNF XPath 2.0的EX pression:的 http://www.w3.org/TR/2007/REC-xpath20-20070123/#id-grammar 和我想的fslex / fsyacc组合使得它在F#的。

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: http://www.w3.org/TR/2007/REC-xpath20-20070123/#id-grammar and I'm thinking of making it in F# with the fslex/fsyacc combination.

我的背景(主观):我打这些工具之前,但仅限于一些简单的EX pressions和一个非常简单的编程语言。此外,我看了大部分的龙书和Appel's现代编译器实现在ML的 - 但不幸的是,我并没有把理论在实践中边阅读。我学的是计算机科学的一年,现在,我已经完成了课程,理论约前有限自动机 CFL 和算法,但我已经开发了多年的大学前(几年与专业工作 - 网站后台为主)

My background (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 finite automaton, CFL and algorithms but I have been a developer for years before university (a few years with professional jobs - back-end of websites mainly).

现在,解析和步骤我倾向于包括:

Now, the steps of parsing and what I tend to cover:

  1. 在莱克斯 - 解析 - 排量:FsLex / FsYacc。我一定会妥善不能涵盖所有的XPath 2.0在第一,但至少所有的东西的XPath 1.0能做+多一点。
  2. 思迈特分析 - 我不知道有多少是这样
  3. 优化 - 我不倾向于掩盖这个(至少不是第一)
  4. 在实际横移等。
  5. ... <?/ LI>
  1. 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.
  2. Sematic analysis - I'm not sure about how much there is to this
  3. Optimization - I do not tend to cover this (at least not at first)
  4. Actual traversing etc.
  5. ...?

现在,在具体问题除了上面的:

  1. 有多困难,使这种规模的解析器?根据我的背景,我会可能呢?
  2. 有没有我都特别想念在问候的XPath 2.0所有关键步骤?
  3. 有我错过了什么技术;我一定要覆盖更多的不仅仅是XPath 2.0和的XDocument 等,才能够使解析器?
  1. How difficult is it to make a parser of this size? based on my background, would I could to it?
  2. Is there any crucial steps I have missed in regards to XPath 2.0 in particular?
  3. Is there any technology I have missed; Do I have to cover more than just XPath 2.0 and XDocument etc. to be able to make the parser?

需要明确的是:我希望做一个的XPath 2.0 EX pression解析器并遍历的XDocument 等,与此分析前pression。我的猜测相结合是一个查询引擎。

To be clear: I want to make a XPath 2.0 expression parser and traverse XDocument etc. with this parsed expression. Which I guess combined is a query engine.

更新:我发现这一点: HTTP:/ /www.w3.org/2007/01/applets/xpathApplet.html 其中包含code到解析和遍历。我认为这将是一个不错的开始或引用: - )

Update: I found this: http://www.w3.org/2007/01/applets/xpathApplet.html which contains code to parsing and traversing. I think it would be a nice start or reference :-)

您的答案将是AP preciated。

Your answers will be appreciated.

推荐答案

我在XSLT 2.0实现的XPath 2.0解析器完全三年前。

我用我的 <一个href="http://fxsl.cvs.sourceforge.net/viewvc/fxsl/fxsl-xslt2/f/func-lrParse.xsl?revision=1.7&view=markup"相对=nofollow> LR分析框架 FXSL 这是不是那么困难。语法是相当大 - 209规则,如果我记得很清楚。我用YACC的modificationn(由我做的),我称之为 Yaccx 生成分析表为XML。这些是输入的 <一个href="http://fxsl.cvs.sourceforge.net/viewvc/fxsl/fxsl-xslt2/f/func-lrParse.xsl?revision=1.7&view=markup"相对=nofollow>一般LR分析器 ,写在XSLT。

I used my LR Parsing Framework in FXSL and this was not so difficult. The grammar is quite big -- 209 rules, if I remember well. I used a modificationn of YACC (done by me) which I call Yaccx to generate the parsing tables as XML. These are the input for the general LR Parser, written in XSLT.

对于这种类型的项目,你需要分配至少6个月的全职,也许1年。困难的是在实施庞大的函数库( F&放大器;Ø )。

For such kind of project you need to allocate at least 6 months full time, maybe 1 year. The difficulty is in implementing the enormous function library (F & O).

同时,XPath是不是一个独立的语言 - 它必须用另一种语言主办。由于这个原因,我没有使用这个分析器用于任何有意义,因为我没有足够的存取,影响力和可能性来改变现有的主导语言。

Also, XPath is not a standalone language -- it must be hosted by another language. Due to this reason I didn't use this parser for anything meaningful, as I didn't have the access, influence and possibility to alter an existing hosting language.

所以,要ppared所有这些困难,$ P $。

So, be prepared for all these difficulties.

这篇关于步骤和实施解析器(在.net - 在这种情况下的XPath 2.0)的参与的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆