I recently took a class at school where we had to learn Scheme to build a parser for a simple made up scheme-like language. As the semester went on, we added to our parser to make it more and more interesting.
Since then, on my own time, I've started writing my own parser that's quite a bit neater than what I did in class, but it parses my C++ code, gathers a list of all the data structures and public members, and generates a recursive descent parser for it. For example, if I have the the following
class Bar
{
public:
int a;
}
class Foo
{
public:
Bar* myBar;
int x;
}
and I run my parser generator on it, it spits out a new class simply called Parser that I can use like this to read from a file:
Parser p;
Foo* f = p.parseFoo("example.txt");
where example.txt would be something like this:
Foo
{
myBar
{
a 5
}
x 10
}
(This is just a simple example, there are some other neat things too like recognizing when it should be push_back-ing onto a vector, and being able to assign function callbacks)
This seems like the type of thing that other (probably smarter) people ought to have done before me. I did some quick Google searches to see what was out there, but there's a lot of stuff to sift though. So my question is this: are there tools out there that do what my parser generator does right now? Is this project worth continuing* or are there better tools out there already?
*of course it's always worth continuing as a learning experience. Rather, I mean from the point of view as a user who would want to read data structures to and from text.