0

I have used pegjs to create a parser, quite similar actually to the example shown here for a custom string-formatting function.

I would like to port this to C++. What might be the best way to do this? Are there are existing parsers in C/C++ that are compliant with the pegjs grammar? Or, would I want to transpile the generated JS with something like V8, or what might be a possible route to do this conversion, aside from manually rewriting everything from scratch?

David542
  • 104,438
  • 178
  • 489
  • 842
  • 1
    https://en.wikipedia.org/wiki/Comparison_of_parser_generators#Parsing_expression_grammars,_deterministic_boolean_grammars – rici Oct 13 '21 at 19:43
  • 1
    parsing expression grammars are basically just a fancy name for recursive descent parsers that handle disjunction using "first match" rather than longest match etc. there are lots of recursive descent parser frameworks for C++. Boost.Spirit for example. – jwezorek Oct 13 '21 at 20:05

0 Answers0