开发者

Translation from Boost Spirit Classic to Qi

开发者 https://www.devze.com 2023-01-09 04:26 出处:网络
开发者_JAVA百科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. Thi
开发者_JAVA百科

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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消