Almost all of the examples I've gone and looked at so far from: http://boost-spirit.com/repository/applications/show_contents.php use the old syntax. I've read and re-read the actual documentation at http://www.boost.org/doc/libs/1_42_0/libs/spirit/doc/html/index.html and the examples therein. I know Joel is starting a compiler series ...
I am writing a small tool for analyzing simple B Machine substitutions as part of a college research work. The code successfully parse test inputs of the form mySubst := var1 + var2. However, I get a pop-up error message saying "This application has requested the Runtime to terminate it in an unusual way. " In the command prompt window, ...
hello.
Boost lambda allows to overwrite deduced return type using ret<T> template.
I have tried searching for equivalent in phoenix but could not find one.
Is there an equivalent in phoenix? I know how to make my own Replacement but I would rather not. thank you
...
I am studying how to use boost spirit Qi binary endian parser. I write a small test parser program according to here and basics examples, but it doesn't work proper. It gave me the msg:"Error:no match".
Here is my code.
#include "boost/spirit/include/qi.hpp"
#include "boost/spirit/include/phoenix_core.hpp"
#include "boo...
Hello, everybody.
I'm newbie in Boost.Spirit.Lex.
Some strange error appears every time I try to use lex::_val in semantics actions in my simple lexer:
#ifndef _TOKENS_H_
#define _TOKENS_H_
#include <iostream>
#include <string>
#include <boost/spirit/include/lex_lexertl.hpp>
#include <boost/spirit/include/phoenix_operator.hpp>
#includ...
I'm having issues getting a small spirit/qi grammar to compile. The build stack trace is fugly enought to not make any sense to me (despite some assertion_failed i could notice in there but that didn't brought much information)
the input grammar header:
inputGrammar.h
#include <boost/config/warning_disable.hpp>
#include <boost/spirit/...
I'm having issues getting a small spirit/qi grammar to compile. i am using boost 1.43 and g++ 4.4.1.
the input grammar header:
the build error seems to be pointing to the definition of the 'instruction' rule, maybe it is the '[sp::_val = sp::_1]' that somehow brokes it but this is more or less based on what the spirit documentation tuto...
Hi,
in this article about boost spirit semantic actions it is mentioned that
There are actually 2 more arguments
being passed: the parser context and a
reference to a boolean ‘hit’
parameter. The parser context is
meaningful only if the semantic action
is attached somewhere to the right
hand side of a rule. We will see ...
I am trying to parse a C-function like tree expressions like the following (using the Spirit Parser Framework):
F( A() , B( GREAT( SOME , NOT ) ) , C( YES ) )
For this I am trying to use the three rules on the following grammar:
template< typename Iterator , typename ExpressionAST >
struct InputGrammar : qi::grammar<Iterator, Express...
Ok
i am trying to build a grammar and currently it looks like this:
#ifndef _INPUTGRAMMAR_H
#define _INPUTGRAMMAR_H
#include <boost/config/warning_disable.hpp>
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix_core.hpp>
#include <boost/spirit/include/phoenix_operator.hpp>
#include <boost/spirit/include/phoe...
I am writing a Boost Spirit grammar to parse text into a vector of these structs:
struct Pair
{
double a;
double b;
};
BOOST_FUSION_ADAPT_STRUCT(
Pair,
(double, a)
(double, a)
)
This grammar has a rule like this:
qi::rule<Iterator, Pair()> pairSequence;
However, the actual grammar of pairSequence is this:
doub...
Hello :)
I've got this simple parser intended to parse VB style double quoted strings. Thus, the parser should turn something like
"This is a quoted string containing quotes ("" "")"
into an output of
This is a quoted string containing quotes (" ")
Here is the grammar I came up with for this:
namespace qi = boost::spirit::qi;
nam...
This is long with a lot of code, so I hope Stack Overflow can cope with it. :P
I'm trying to write an SVG parser with Boost Spirit. I have a grammar that populates a vector with "Contours," which are vectors of "BezierPoints," which may represent either regular points or points with bezier controls.
So far I have this (not handling re...
Say I have a Boost Spirit grammar like this, where a parent rule passes an inherited attribute to its children.
template <typename Iterator>
struct MyGrammar : qi::grammar<Iterator, vector<Foo>()>
{
qi::rule<Iterator, vector<Foo>()> start;
qi::rule<Iterator, vector<Foo>(Bar)> parent;
qi::rule<Iterator, Foo(Bar)> child1;
...
I have created a test application to illustrate my problem. It parses a list of integers preceded by "a=" or "b=" and is separated by "\r\n". The list contains multiple occurrences of those fields in any order.
#include <string>
#include <vector>
#include <iostream>
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/includ...
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 wi...
Hi,
I have tried various approaches to fixing this issue with maps and casts, splitting the parse into different sub-pieces, using std::vector directly and trying _r1 etc. but I seem to have failed to grasp something fundamental about the use of attributes.
I want to parse a line such as:
DEFMACRO macroname param1 param2 param3 ... pa...
I am trying to write a shell language parser in Boost.Spirit. However, I am unclear about some basic issues regarding semantics of rules.
Looking at the documentation, there are members r.alias() and r.copy() of rule. IIUC, these members should return a reference to the rule and a copy of the rule's contents, respectively. However, it i...
I'm using attribute propagation to construct a syntax tree for a toy language. I've hit a problem at the definition of my if statement, it's hard to tell from the error message but I think the rhs attribute isn't collapsing into the expected attribute. It should collapse to a tuple <double,Statement,optional<Statement>> I think.
The err...
I made some tests using the spirit mini_c sample. Unfortunately it does not keep the operator precedence as expected:
int main()
{
return 3 > 10 || 3 > 1;
}
evaluates to 0.
return (3 > 10) || (3 > 1);
returns 1
I tried to move the definition of "||" and "&&" to the very top in the constructor of
template <typename Iterator>
...