开发者

building c++ config file parser using lex and yacc

开发者 https://www.devze.com 2023-04-10 02:44 出处:网络
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

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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号