Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Blog: Parsing command line parameters with Yacc & Flex

99 views
Skip to first unread message

Johann 'Myrkraverk' Oskarsson

unread,
Jun 5, 2012, 1:12:22 PM6/5/12
to
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

Johann 'Myrkraverk' Oskarsson

unread,
Jun 6, 2012, 6:43:16 AM6/6/12
to
Sorry about the missing URL, it's below.

> I wrote a blog tutorial about how to use yacc & (re)flex to parse
> command line arguments. Here is the blurb: ...
>
http://my.opera.com/myrkraverk/blog/2012/06/05/parsing-command-line-parameters-with-yacc-flex

If it becames mangled somehow it's easily enough retrievable at

http://my.opera.com/myrkraverk/blog/

--
Johann Oskarsson http://www.2ndquadrant.com/ |[]
PostgreSQL Development, 24x7 Support, Training and Services --+--
|
Blog: http://my.opera.com/myrkraverk/blog/
0 new messages