12

I need to write a simple parser to a sort of Domain Specific Language.
It needs to have basic arithmatics with proper operators evaluation order and a syntax to call functions of the underlying environment which can be overloaded.
What is the simplest way to write such a parser? Is there something I can adapt or use out of the box? I'm writing in C++.

shoosh
  • 76,898
  • 55
  • 205
  • 325

4 Answers4

8

Take a look at Boost Spirit.

dirkgently
  • 108,024
  • 16
  • 131
  • 187
3

See MetaII parser technology. This tutorial walks you through everything:

http://www.bayfronttechnologies.com/mc_tutorial.html

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

ANTLR will help you a lot.

Elroy
  • 605
  • 4
  • 12
  • 20
1

I used Ragel parse some data. It worked pretty well for me.

nuriaion
  • 2,621
  • 2
  • 23
  • 18