0

I need to change the grammar rules of my parser at runtime and I would like to avoid regenerating the parser each time the rules changes.

Is there a parser that do not use code generation?

Regards,

2 Answers2

0

You can use (meaning probably implement yourself, not likely to be a library lying around) an Earley parser.

You will of course pay an overhead price for this. If your grammar and the source it parses are small, this is likely to be fine.

Otherwise you might reconsider; why is it that you don't want to rebuild the parser? Most parser generators run far faster than people can edit rules.

Ira Baxter
  • 93,541
  • 22
  • 172
  • 341
0

You could use a PEG (either hand-written or something like boost:spirit)

PEGs are not a strict superset of LL grammars, but are generally more expressive, as they have various extra features such as limited negation and following context testing.

Chris Dodd
  • 119,907
  • 13
  • 134
  • 226