Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!news.iecc.com!nerds-end From: Johann 'Myrkraverk' Oskarsson Newsgroups: comp.compilers Subject: Blog: Parsing command line parameters with Yacc & Flex Date: Tue, 05 Jun 2012 17:12:22 +0000 Organization: A noiseless patient Spider Lines: 35 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <12-06-005@comp.compilers> NNTP-Posting-Host: news.iecc.com X-Trace: leila.iecc.com 1338975541 50572 64.57.183.58 (6 Jun 2012 09:39:01 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Wed, 6 Jun 2012 09:39:01 +0000 (UTC) Keywords: parse, yacc Posted-Date: 06 Jun 2012 05:39:01 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: csiph.com comp.compilers:666 Hi all, I wrote a blog tutorial about how to use yacc & (re)flex to parse command line arguments. Here is the blurb: > Every once in a while someone comes along and asks how to parse > command line parameters with Yacc & Flex. This is rather straight > forward, but requires some knowledge of the generated code to get > right. > Here we present a source template that does this. The user only has to > edit the grammar and scanning rules. Some knowledge of C, Yacc and > Flex is assumed. > > The code is Boost licensed > > The template is written for Berkeley Yacc and the reflex variant of > Flex. It may be made to work with GNU Bison and SourceForge Flex, > possibly with a few changes. I feel this tutorial is about 20 years too late, but no matter, it's here now. There are questions on stack exchange which might benefit from a pointer to the blog entry. Depending on the promptness of our moderator, the blog entry may be referenced there by the time you're reading this. If you want to use this in a project and don't want to read and understand the boost license, I can put up another WTFPL licensed download. -- Have fun, Johann