LL parser framework represents parsers directly as EBNF grammars in inlined C++14
Questions tagged [boost-spirit-x3]
281 questions
0
votes
3 answers
boost::spirit::x3 phrase_parse doing arithmetic operations before pushing into vector
I'm working on a project for my univertitiy studies. My goal is to read double numbers from a large file (2,6 GB) into a double vector.
I am working with the boost spirit x3 library with mmap. I have found some code in the net:…

squbr_
- 3
- 1
0
votes
0 answers
Howto register error handler with boost spirit x3?
I have some troubles getting the error handler to work with boost spirit x3. I was looking at the documentation (https://www.boost.org/doc/libs/1_70_0/libs/spirit/doc/x3/html/spirit_x3/tutorials/error_handling.html) but I don't understand the…

Max
- 638
- 1
- 4
- 19
0
votes
1 answer
Parse Eigen Matrix with Boost Spirit X3
I'm trying to parse an Eigen::Matrix3f matrix with Boost Spirit X3, where the input string is matrix(a,b,c,d,tx,ty) and the resulting Eigen 3x3 matrix will be the following:
[a, c, tx
b, d, ty
0, 0, 1]
I can already synthesize std::vector…

Jaime Ivan Cervantes
- 3,579
- 1
- 40
- 38
0
votes
1 answer
how to change the parser of a rule
Is it possible to modify the parser of a rule at runtime? I am able to dynamically create parsers (classes that are derived from parser_base), but I dont know how I can assign the new parser to an existing rule.
Basically my problem is that I want…

codingdave
- 1,207
- 16
- 23
0
votes
1 answer
x3 modify parser at runtime
I wonder if it is possible to change the parser at runtime given it does not change the compound attribute.
Lets say I want to be able to modify at runtime the character of my parser that detects whether I have to join a line from ; to ~. Both are…

codingdave
- 1,207
- 16
- 23
0
votes
1 answer
Simple sematic action destroys the result in Spirit X3
I have this Spirit X3 parser
auto xyz_def =
x3::omit[x3::int_] >> x3::eol >>
(x3::lexeme[+(x3::char_ - x3::eol)]) >> x3::eol >>
(*(chemical::parser::atom >> x3::eol)
;
Which parses, with no problem something like…

alfC
- 14,261
- 4
- 67
- 118
0
votes
0 answers
Issue with X3 and MS VS2017
I am having a weird problem with boost spirit X3 (v1.69) in combination with MS VS2017.
I am getting compiling errors in well formed structures. When I use the same code block in gcc and clang through Coliru or Wandbox, the source compiles and…

Pablo
- 557
- 3
- 16
0
votes
1 answer
For spirit::x3, what is the right way to deal with unknown symbols?
A newbie for x3... The code is adapted from the roman.cpp in the x3 tutorial. Suppose I have a symbol table like below:
struct car_models_ : x3::symbols
{
car_models_()
{
add
("sedan", 1)
…

user180574
- 5,681
- 13
- 53
- 94
0
votes
1 answer
Improvements in repeat directive with variable factor for X3
I need to parse a sequence of elements where there is a first number telling how many elements must be parsed next.
As a simplification of what I need: [3 10 20 30] should be parsed as showed next:
- Number of elements: 3
- Vector of elements: {10,…

Pablo
- 557
- 3
- 16
0
votes
0 answers
Position annotation for sequences in Spirit X3
What is considered good form for adding position annotations for rules that return sequences?
Assuming I have a rule in my grammar of the form:
const auto array_def = '[' >> *int_ >> ']';
that synthesizes an attribute of type std::vector< int >, I…

Engineerist
- 367
- 2
- 13
0
votes
1 answer
Parsing map of variants with Boost Spirit X3
I am trying (and failing) to parse a map> using Boost Spirit X3, with the following code:
#include
#include
#include…

Jaime Ivan Cervantes
- 3,579
- 1
- 40
- 38
0
votes
1 answer
Parsing CSS with Boost.Spirit X3
I'm attempting to write a (partial) CSS parser using Boost.Spirit X3.
I have the (very) basic setup working:
const auto declaration_block_def = '{' >> +declaration >> '}';
const auto declaration_def = property >> ':' >> value >> ';';
const auto…

rubenvb
- 74,642
- 33
- 187
- 332
0
votes
1 answer
Automatic attribute propagation sometimes doesn't work when combining `%` and optional suffixes
Using boost 1.61, on both clang 3.8.0, and GCC 5.4, I get errors when compiling the following code:
#include
#include
#include
#include
#include
#include…

Paul Belanger
- 2,354
- 14
- 23
0
votes
1 answer
Spirit.X3 with lambda returning different parser types
Here I try to convert a string literal to a number, where the base specifer is dynamic:
#include
#include
namespace ast {
struct literal {
enum base_specifier { bin, oct, hex };
…

Olx
- 163
- 8
0
votes
1 answer
Does Boost Spirit X3 support left recursion?
One of the shortcomings/implementation challenges of recursive-descent parsers is dealing with left recursion, e.g.
:= '+'
|
The parser needs to parse an expr before it can parse an expr...
Now,…

einpoklum
- 118,144
- 57
- 340
- 684