Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting started guide for Boost.Spirit? [closed]

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?

like image 507
Anteru Avatar asked Jul 14 '09 08:07

Anteru


People also ask

What is Boost:: spirit?

Boost Spirit is an object-oriented, recursive-descent parser and output generation library for C++. It allows you to write grammars and format descriptions using a format similar to Extended Backus Naur Form (EBNF) directly in C++.

Is boost spirit header only?

Spirit is a header file only library.


1 Answers

An introductory article from CP

A JSON parser implemented using Boost.Spirit from CodeProject

Spirit Application Repository

like image 145
Modicom Avatar answered Oct 24 '22 01:10

Modicom