Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED!nerds-end From: mtreibton@googlemail.com Newsgroups: comp.compilers Subject: Parsing/defining getopt style strings Date: Mon, 17 Aug 2015 13:51:03 -0700 (PDT) Organization: Compilers Central Lines: 25 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <15-08-013@comp.compilers> NNTP-Posting-Host: news.iecc.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: miucha.iecc.com 1439857478 62771 2001:470:1f07:1126:0:676f:7373:6970 (18 Aug 2015 00:24:38 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Tue, 18 Aug 2015 00:24:38 +0000 (UTC) Keywords: parse, question, comment Posted-Date: 17 Aug 2015 20:24:38 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:1589 Hello all, I have an existing application which uses a lot of YACC for its configuration file. In trying to stream-line a lot of options, and for wider changes surrounding the application itself, I'm looking at trying to define something in YACC which would allow to the inclusion of getopt style strings. Is this possible? By getopt, I mean BSD-style getopt where there's only a single-letter option. Hence, in terms of what this might look like in the configuration file itself, I was thinking: some_command -ab -c option some_other_option Where you can see "-ab" in this case are just options, with "-c" taking an "option", and then "some_other_option" being separate. Is this even possible, I wonder? TIA! [Sure. Find a copy of the 1992 lex&yacc and it was one of our examples. You'll have to write your own yyinput routine to feed the argument strings to the parser but that's not hard. -John]