Questions tagged [boost-spirit-x3]

LL parser framework represents parsers directly as EBNF grammars in inlined C++14

281 questions
2
votes
1 answer

Parsing a list of strings followed by a list of strings with spirit x3

I am trying to parse a string into a struct using boost spirit x3: struct identifier { std::vector namespaces; std::vector classes; std::string identifier; }; now I have a parser rule to match a strings like…
Exagon
  • 4,798
  • 6
  • 25
  • 53
2
votes
1 answer

Parsing into a set using boost spirit x3

I am interested in if there is a way to parse into a set using boost spirit x3. the background is I have a string of tokens, each token represents a enum value, now i want to create a parser which parses if every every token is at most once in the…
Exagon
  • 4,798
  • 6
  • 25
  • 53
2
votes
2 answers

parsing into structs with boolean or enum members with boost spirit x3

If I have a struct: struct person{ bool is_male; std::string name; std::vector friends; } or enum class gender_t{male, female} struct person{ gender_t gender; std::string name; …
Exagon
  • 4,798
  • 6
  • 25
  • 53
2
votes
1 answer

Parsing recursive rules with spirit x3

I would like to parse the following recusive rule which parses simple template classe identifier like foo foo foo> here is the simple grammar: identifier := A-Z | a-z | _ class_identifier = identifier ?("<"…
Exagon
  • 4,798
  • 6
  • 25
  • 53
2
votes
1 answer

x3::symbols moves result and therefore removes it from the symbol_parser itself

So, I ran into strange behaviour with boost::spirit::x3 as supplied in boost 1.59: I defined a 'dynamic' symbol table via: struct instructions : x3::symbols { instructions() { name("instructions"); } void…
UsYer
  • 173
  • 1
  • 8
2
votes
1 answer

Boost Spirit X3 Skip Parser Implementation?

For the current grammar I am parsing with X3, whitespace and Perl-style comments are ignored. It seems to me that a skip parser in X3 is just a normal parser, and whatever input it consumes is considered "skipped." I came up with this: namespace x3…
Zac
  • 876
  • 1
  • 8
  • 18
2
votes
1 answer

Spirit X3 parser start state?

I've been going through the Boost.Spirit X3 documentation I've been able to find---which isn't much---and think I would like to use this for my next parsing project. Notably I have never used Boost.Spirit Classic or V2, but have used flex/bison and…
Zac
  • 876
  • 1
  • 8
  • 18
2
votes
2 answers

Overloaded output operator not found for Boost.Spirit expression

This is a follow-up on this Q&A. I now have several data structures in a namespace ast, subdivided over two sub-namespaces (algebraic and numeric) that correspond to the two different formats that the grammar recognizes. namespace ast { …
TemplateRex
  • 69,038
  • 19
  • 164
  • 304
2
votes
1 answer

Compile errors C++ Spirit X3 No viable overloaded =, No matching function for call to move_to

Michael Caisse gave a talk on Spirit X3: https://www.youtube.com/watch?v=xSBWklPLRvw. I've tried to transcribe the presentation to working code, but I have compilation errors that include "No viable overloaded '='" and "No matching function call to…
John Estess
  • 576
  • 10
  • 22
2
votes
1 answer

Stop X3 symbols from matching substrings

How does one prevent X3 symbol parsers from matching partial tokens? In the example below, I want to match "foo", but not "foobar". I tried throwing the symbol parser in a lexeme directive as one would for an identifier, but then nothing…
KentH
  • 1,204
  • 1
  • 14
  • 23
2
votes
1 answer

What are the installation procedures for Boost Spirit 3.0.0?

For this system configuration: lubuntu 15.04 Ubuntu clang version 3.6.0-2ubuntu1 (tags/RELEASE_360/final) (based on LLVM 3.6.0) libboost-dev 1.55.0.2 #define SPIRIT_VERSION_NOVEMBER_13_2008_0834AM What are the installation procedures for Boost…
CW Holeman II
  • 4,661
  • 7
  • 41
  • 72
1
vote
1 answer

boost::spirit X3 -- Why can it not be found from the list of libraries?

Why is this library not listed in the directory of the matching boost version? What are the differences compared to v2.*? What are the required/supported C++ standards?
Frank Puck
  • 467
  • 1
  • 11
1
vote
2 answers

Parse Html with Boost Spirit X3

I'm trying to write a parser to parse html with boost spirit x3, and I wrote parsers below: The problem is these code can't compile. Error is : fatal error C1202: recursive type or function dependency context too complex I know this error comes…
1
vote
1 answer

boost x3 grammar for structs with multiple constructors

Trying to figure out how to parse structs that have multiple constructors or overloaded constructors. For example in this case, a range struct that contains either a range or a singleton case where the start/end of the range is equal. case 1: look…
Mikhail
  • 7,749
  • 11
  • 62
  • 136
1
vote
1 answer

Grammar fails parsing tree with Boost Spirit X3

I am playing with parsing a Newick tree format using Boost Spirit x3, and I fail at parsing a complete tree. Minimal reproducible example This is my attempted solution: namespace quetzal::newick::parser { namespace x3 = boost::spirit::x3; using…
WaterFox
  • 850
  • 6
  • 18