Related articles |
---|
Any example of a configuration-file parser? Alessandro.Bottoni@think3.com (Alessandro Bottoni) (1999-12-10) |
From: | Alessandro Bottoni <Alessandro.Bottoni@think3.com> |
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:
[GLOBALS]
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
(Alessandro.Bottoni@Think3.com)
(abottoni@yahoo.com)
Web Programmer
Think3 inc.
(www.think3.com)
Return to the
comp.compilers page.
Search the
comp.compilers archives again.