LL parser framework represents parsers directly as EBNF grammars in inlined C++14
Questions tagged [boost-spirit-x3]
281 questions
1
vote
1 answer
When to use x3::lit in Boost spirit
I am beginning with Boost Spirit x3 parsing library - and I'm very excited about it.
One thing unclear to me is when and why one should use x3::lit.
From what I understood, it's because we can not expect an expression like ']' >> double_ to be…

WaterFox
- 850
- 6
- 18
1
vote
0 answers
Functionality of x3::raw
I'm new to spirit x3 and was wondering what x3::raw is good for. I experimented with a simple parser following an example from qi:
const auto rule= (x3::alpha | '_') >> *(x3::alnum | '_');
const auto rule_raw= x3::raw[ rule ];
string in = "Jame007 …

august_71
- 93
- 1
- 4
1
vote
1 answer
How to declare context type whe using multiple 'with' directives?
I have known that it is possible to get information like position_cache and error_handler at the same time by using multiple with directives refer to this doc:…

Alfred Li
- 25
- 1
- 4
1
vote
1 answer
how to avoid ambiguity of grammar when using boost spirit rule?
I was using boost.spirit.x3 to build a grammar for a script language, and I found an example in the boost which called cal9,and I need somehing like that but it lack the if-else statement parsing. so I added the following code to the statement…

Alfred Li
- 25
- 1
- 4
1
vote
1 answer
even using error_handler got uncaught x3::expectation_failure
As I try to rewrite my Spirit X3 grammar, I put some rules (e.g. char_ > ':' > int_ > '#') into a parser class like this one shown here:
struct item_parser : x3::parser {
using attribute_type = ast::item_type;
…

Olx
- 163
- 8
1
vote
1 answer
Getting custom error on rule level using Spirit X3
After reading Custom error on rule level? #657 I thought I'll brave, adapt and combine it with sehe's approach at How do I get which() to work correctly in boost spirit x3 expectation_failure?. Unfortunately, I didn't get it to work - somewhere I've…

Olx
- 163
- 8
1
vote
1 answer
Boost spirit x3 - lazy parser with compile time known parsers, referring to a previously matched value
Inspired from sehe's answer at
Boost spirit x3 - lazy parser
I tried to adapt it to one of my own problem (which is another story).
My grammar to implement has several ways to express numerical literals with
bases of 2, 8, 10 and 16. I've reduced…

Olx
- 163
- 8
1
vote
1 answer
Boost Spirit x3 - parser doesn't recognize end of line
I am trying to parse an .obj file, but i can't figure out how to make x3 stop at the end of a line.
My code looks like this:
#include
#include
#include
#include…
user13310405
1
vote
1 answer
Spirit.X3: passing local data to a parser
The examples in the Boost.Spirit documentation seem to fall in two cases:
1/ Define a parser in a function: semantic actions can access local variables and data as they are local lambdas. Like push_back here:…

Jean-Michaël Celerier
- 7,412
- 3
- 54
- 75
1
vote
1 answer
How do I get which() to work correctly in boost spirit x3 expectation_failure?
Calling which() in expectation_failure returns a strange std::string.
How can I fix it?
#include
#include
#include
namespace x3 =…

user17810163
- 35
- 4
1
vote
1 answer
Why does my component compile as a container but spirit::x3::int_parser does not?
I have been working on a better understanding of compile time code especially where spirit::x3 is concerned. I have a class my_uuid and it is working fine compiled with x3::rule. But as Iterator is declared outside of the scope, it is only good for…

lakeweb
- 1,859
- 2
- 16
- 21
1
vote
1 answer
Incorrect rule matched in boost spirit x3 grammar
I am a bit of a newbee using Spirit.
I am trying to construct an AST tree from a simple "excel" formula using spirit x3. The grammar supports typical operators (+,-,*,/), functions (myfunc(myparam1, myparam2)) and cell references (eg A1, AA234).
So…

Michael
- 13
- 2
1
vote
1 answer
Boost X3: Can a variant member be avoided in disjunctions?
I'd like to parse string | (string, int) and store it in a structure that defaults the int component to some value. The attribute of such a construction in X3 is a variant>. I was thinking I could have a struct that…

Michaël
- 400
- 5
- 18
1
vote
2 answers
Boost spirit X3 : how to process in case of an optional that can be nullopt in an alternative case?
In case of alternative, where in one path there is nothing to match for an optional, how to process ?
Consider this mvce. This is not my real example but the minimal example I could imagine to express what I am intending to do :
Parsing into a foo…

sandwood
- 2,038
- 20
- 38
1
vote
1 answer
Compilation performance issues with boost spirit x3
This is a much too delayed follow on question to something I have previously asked. Basically, I have a fairly parameterized parser for a series of languages written in boost spirit x3. @sehe greatly helped me get even that far:
Boost Spirit x3 --…

Timothy Braje
- 47
- 4