flex/bison config file parser

David Relson relson at osagesoftware.com
Sat Mar 1 16:36:05 CET 2003


At 10:11 AM 3/1/03, Matthias Andree wrote:
>Hi,
>
>I have some stuff to let bison and flex build our parser, all that's
>left for us is intergrate. Do we want to go that way and depend on bison
>at packaging time and ship the ready-made parser_config.tab.[hc] just as
>we ship ready-made parsers' c code (the lexer*.c stuff)?
>
>Do we want to keep our current ad-hoc parser?

It's been years since I used yacc.  In the early 90's I worked for a 
company writing CASE (Computer Aided Software Engineering) tools and used 
yacc in a project.  A few years later I wrote some bookkeeping software for 
charitable organizations and used yacc for parsing their bif (Bingo 
Information File) files, which contained the info on what they sold, what 
games they played, and their payouts.

I'm inclined to apply KISS at this time and vote for our simple ad-hoc 
parser.  If you don't mind, I'll add a function to trim comments from the 
end of the line before passing values to xatox().

>If you want to try that code, you'll need bison or yacc in addition to
>the tools you usually need to build bogofilter from CVS.
>
>To compile:
>
>flex lexer_config.l
>
>bison -d parser_config.y
># alternative: yacc -d -b parser_config parser_config.y
>
>gcc -g -O -DYYDEBUG=1 -o parser_config \
>     parser_config.tab.c lex.lexer_config_.c -I. xmalloc.o xmem_error.o
>
>To try:
>
>./parser_config <../bogofilter.cf.example

I'll load bison and experiment some.  Perhaps I change my thoughts from 
"ad-hoc parser" to "formal lexer".

Enjoy!

David





More information about the bogofilter-dev mailing list