Boost.Spirit入门指南? [英] Getting started guide for Boost.Spirit?

查看:82
本文介绍了Boost.Spirit入门指南?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近一直在看Boost.Spirit(Boost 1.39中包含的版本),但是仅凭文档我就感到很困惑.我正在寻找的是使用Boost.Spirit实现的玩具语言的示例-类似于小型Javascript或Lua的东西,您基本上在其中创建AST和过程.如果它仅支持函数/变量定义和基本运算符,我会很高兴,我只想看看您如何使用Boost.Spirit创建普通的AST,以及如何实现基本规则(例如标识符,声明等).

到目前为止,我已经尝试了计算器示例,但是对于我来说如何使用Spirit实施更大的语法尚不清楚.另一方面,捆绑了mini_c的示例看起来已经非常复杂,并且没有得到很好的文档说明.那里有一些易于理解的Boost.Spirit指南,还是一本书?

解决方案

来自CP

使用CodeProject中的Boost.Spirit实现的JSON解析器

精神应用程序存储库

I've been looking recently at Boost.Spirit (the version included in Boost 1.39), however I'm quite confused from the docs alone. What I'm looking for is for an example of a toy language implemented with Boost.Spirit -- something along the lines of a tiny Javascript or Lua or so, where you basically create an AST and process is. I'd be happy if it just supports function/variable definitions and the basic operators, I just want to see how you would create a normal AST using Boost.Spirit, and how to implement basic rules like identifiers, declarations, etc.

So far, I've tried the calculator example, but it's unclear for me how to implement a larger grammar with Spirit. The mini_c example which is bundled on the other hand looks quite complicated already, and it's not too well documented. Is there some easy to understand guide to Boost.Spirit out there, or a book maybe?

解决方案

An introductory article from CP

A JSON parser implemented using Boost.Spirit from CodeProject

Spirit Application Repository

这篇关于Boost.Spirit入门指南?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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