从Boost Spirit Classic到Qi的翻译

发布于 2024-09-10 21:20:45 字数 346 浏览 2 评论 0原文

我昨天开始使用精神。我必须为一种小语言编写一个解析器并形成一个中间数据结构。我按照 Boost Repository 中的 Pascal Parser 示例进行操作。这个例子很好,因为它支持简单的调试。该示例使用 Classic Spirit。

  • 我应该翻译成使用气(到目前为止我还没有遇到任何有关精神的问题)吗?
  • 有这样的转换的简单示例吗?我现在主要使用 classic::grammar 类,如示例所示。

I started using spirit yesterday. I have to write a parser for a small language and to form an intermediate data structure. I followed the Pascal Parser example at Boost Repository. This example is good as it supports easy debugging. The example uses Classic Spirit.

  • Should I translate to use Qi (I have not faced any issues till now with respect to Spirit)?
  • Is there a simple example for such a conversion? I am mainly using classic::grammar class right now as in the example.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

煞人兵器 2024-09-17 21:20:45

如果您开始一个新项目,我绝对建议坚持使用 Spirit.Qi。仅当 Spirit.Qi 正在积极开发时,Spirit.Classic 才处于维护模式。此外,Qi 生成的解析器比旧的解析器快很多。

从 Spirit.Classic 到 Spirit.Qi 的转换并不简单,因为 API 已发生变化。有一些开始的文档不过,在这一点上。但是,如果您开始一个新项目,这应该不会太重要,因为无论如何您都必须习惯新的库。

所以我建议你尝试阅读 介绍性文档,查看 Spirit 附带的示例和测试,最重要的是尝试了解 Spirit 如何处理解析器属性。根据我的经验,解析器属性及其传播规则是最难理解的概念,但同时它们对于 Spirit 的做事方式至关重要,并且它们使 Spirit 如此强大和灵活。

If you start a new project I definitely suggest to stick with Spirit.Qi. Spirit.Classic is in maintenance mode only while Spirit.Qi is being actively developed. In addition, the parsers generated by Qi are a lot faster than the older ones.

The conversion from Spirit.Classic to Spirit.Qi is not straightforward as the API has changed. There is some getting started documentation on this, though. But if you start with a new project this shouldn't matter too much as you have to get accustomed with a new library in any case.

So I'd suggest you try to read the introductory documentation, look at the examples and tests which come with Spirit, and most importantly try to understand how Spirit handles the parser attributes. From my experience, parser attributes and their propagation rules are the most difficult concept to understand, while at the same time they are crucial to Spirit's way of doing things, and they make Spirit as powerful and flexible as it is.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文