Antlr can create a good SQL parser (C ++ can be for it), and several SQL grammars are available for it: http://www.antlr3.org/grammar/list.html
If all that interests you is the names of the tables, then taking one of these grammars and adding a semantic action that collects these names should be fairly simple.
With experience with Antlr and Bison / Yacc and Lex / Flex, I definitely recommend Antlr. It is written in Java, but the target language can be C ++ - the generated code is actually readable, looks like it is written by a person. Debugging generated by the Antlr parser is quite normal, which cannot be said about those that were created by Bison ..
There are other options, such as, for example, Lemon and sqlite grammar, look at this question if you want: SQL parser in C
source share