振作精神; Qi或X3? [英] Getting into boost spirit; Qi or X3?

查看:81
本文介绍了振作精神; Qi或X3?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在和一个朋友一起为一个小型个人项目做口译;我们开始实现所有类和通用结构,在这些类和通用结构中,代码将被翻译然后执行,只是将实际的解析代码推迟到这些结构中.

I was making an interpreter for a small personal project with a friend; we started implementing all the classes and general structure in which the code would be translated to then execute just to postpone the actual parsing code into these structures.

现在我们必须构建解析器,经过一番搜索,我发现各地到处都是谈论Spirit Qi和Spirit X3的帖子和人们,好像他们(我认为是)两种不同的解析器制作方式一样,但是没有人说这种差异,哪一种是最近的,我应该从哪一种开始.

Now we have to build the parser, and after some search I found posts and people all over the place speaking about spirit Qi and spirit X3 as if they were (i think they are) 2 different ways of making a parser, but no-one saying the difference, which one is more recent, which one should i begin with.

目的是给定代码字符串,输出最终错误,如果一切都遵循语法和逻辑,则将代码转换为我们已经构建的类的树.我们想在解析过程中检查一致性,例如您正在使用未声明的变量"这类错误.

The purpose would be, given a code string, output eventual errors, and if everything respects grammar AND logic, translate the code into a tree of the classes we already built. We'd like to check consistencies during parsing, for example the "you're using a variable that wasn't declared" kind of error.

我不确定这两个库如何区别对待.

I'm not sure how the 2 libraries treat things differently.

推荐答案

X3是更新的,仍处于试验阶段,需要C ++ 14.

X3 is more recent, still experimental and requires C++14.

Qi是

  • 更稳定
  • 更轻松地支持更多有状态选项
  • 支持惰性解析器(您可能会喜欢)
  • 编译慢得多

文档是

  • https://www.boost.org/doc/libs/1_68_0/libs/spirit/doc/html/spirit/qi.html
  • https://www.boost.org/doc/libs/1_68_0/libs/spirit/doc/x3/html/index.html

这篇关于振作精神; Qi或X3?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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