Blog: Parsing command line parameters with Yacc & Flex

Johann 'Myrkraverk' Oskarsson <myrkraverk@yahoo.com>
Tue, 05 Jun 2012 17:12:22 +0000

          From comp.compilers

Related articles
Blog: Parsing command line parameters with Yacc & Flex myrkraverk@yahoo.com (Johann 'Myrkraverk' Oskarsson) (2012-06-05)
Re: Blog: Parsing command line parameters with Yacc & Flex johann@2ndquadrant.com (Johann 'Myrkraverk' Oskarsson) (2012-06-06)
| List of all articles for this month |
From: Johann 'Myrkraverk' Oskarsson <myrkraverk@yahoo.com>
Newsgroups: comp.compilers
Date: Tue, 05 Jun 2012 17:12:22 +0000
Organization: A noiseless patient Spider
Keywords: parse, yacc
Posted-Date: 06 Jun 2012 05:39:01 EDT

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


Post a followup to this message

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