• 配置文件格式


    之前我尝试使用yaml用到c中,結果发现,对于c是不合适的,它适合于ruby,py,要入乡随俗

     

    几乎完整的程序或者软件, 都有配置信息, 一般保存在文件中. C/C++ 语言的项目一般使用 .ini 文件作为配置文件. ini 文件和成熟的库供使用, 但缺点很明显, 很难表达父子关系, 因为配置信息应该是一根树 - 配置树.

    著名的Web Server Lighttpd 使用 LEMON 来解析配置文件. 有些软件还使用 Lua/Python 等脚本语言来做配置管理. 但很多时候没有这个必要.

    http://www.ideawu.net/person/config/

    The LEMON Parser Generator

    The Lemon program is an LALR(1) parser generator. It takes a context free grammar and converts it into a subroutine that will parse a file using that grammar.

    Lemon is similar to the much more famous programs "YACC" and "BISON". But lemon is not compatible with either yacc or bison. There are several important differences:

    • Lemon using a different grammar syntax which is less prone to programming errors.
    • The parser generated by Lemon is both re-entrant and thread-safe.
    • Lemon includes the concept of a non-terminal destructor, which makes it much easier to write a parser that does not leak memory.

    The complete source code to the lemon parser generator is contained in two files. The file lemon.c is the parser generator program itself. A separate file lempar.c is the template for the parser subroutine that lemon generates. Documentation on lemon is also available.

     

    Both the source code to lemon itself and the code that lemon generates are in the public domain.

    To see an example of how to use lemon, see the source code to the SQLite database engine. Lemon is maintained as part of the SQLite project.

  • 相关阅读:
    TreeView设置节点图标
    DELPHI 重命名文件名时 文件存在自动重命名
    ExtractNewFolderPath
    Delphi 记事本 TMemo
    Memo打印1
    Windows10和CentOS7双系统安装的一些小技巧
    正则表达式总结
    Java_得到GET和POST请求URL和参数列表
    【Restful】三分钟彻底了解Restful最佳实践
    Win7下U盘安装CentOS-7-x86_64-DVD-1503-01
  • 原文地址:https://www.cnblogs.com/lexus/p/2246041.html
Copyright © 2020-2023  润新知