building c++ config file parser using lex and yacc
I am trying to build config file parser (c++ application)from scratch using tools like lex and yacc. The parser will be able to parse files like
# Sub group example
petName = Tommy
Owner = {
pet = "%petName%"
}
Is there any step by step guide/link to articles on how to achieve this using tools like lex and yacc? The idea is I will write a class开发者_Go百科 say Config (c++) with methods like getConfig(string propName). If I invoke like config.getConfig(Owner.pet), it will return me Tommy.
Boost Property Tree
It was designed for configuration files. It does reading, writing in the following formats:
- INI
- INFO
- XML
- JSON
Here is the five minute tutorial page which should give you a good idea:
- http://www.boost.org/doc/libs/1_47_0/doc/html/boost_propertytree/tutorial.html
精彩评论