Any example of a configuration-file parser?

Alessandro Bottoni <>
10 Dec 1999 14:58:10 -0500

          From comp.compilers

Related articles
Any example of a configuration-file parser? (Alessandro Bottoni) (1999-12-10)
| List of all articles for this month |

From: Alessandro Bottoni <>
Newsgroups: comp.compilers
Date: 10 Dec 1999 14:58:10 -0500
Organization: Compilers Central
Keywords: parse, question

With most of my MSVC++ programs I have to use a configuration file,
similar to the old .INI files (or similar to a C-preprocessor
file...). That file has to contain section definitions, variable
assignements and, maybe, a few simple IF-THEN-ELSE sentences,
something like:

UserName = "Alessandro Bottoni"
Index = 0
Limit = 10.34
IF NetworkAvailable THEN SendE-Mail ELSE JustLogEvents

This config file has to be parsed, its variables values have to be
passed to the calling application and the mentioned functions have to
be called in the higher-level software layer.

As natural, I'm looking to Lex/Flex and Yacc/Bison as possible tools to
develop the required lexer/parser.

Does anybody know of any good example of such a parser, something that
I can use as a starting point? I think that this task should be a
quite common assignement for students of compilers construction...

Thanks in advance.

Alessandro Bottoni
Web Programmer
Think3 inc.

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.