Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED!nerds-end From: Evangelos Drikos Newsgroups: comp.compilers Subject: Re: parsing bibtex file with flex/bison Date: Wed, 06 Mar 2013 13:45:01 +0200 Organization: An OTEnet S.A. customer Lines: 20 Sender: johnl@iecc.com Approved: comp.compilers@iecc.com Message-ID: <13-03-004@comp.compilers> References: <13-03-003@comp.compilers> NNTP-Posting-Host: news.iecc.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: leila.iecc.com 1362591281 9995 64.57.183.58 (6 Mar 2013 17:34:41 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Wed, 6 Mar 2013 17:34:41 +0000 (UTC) Keywords: parse, lex Posted-Date: 06 Mar 2013 12:34:41 EST 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:865 On 3/5/13 1:48 AM, bnrj.rudra@gmail.com wrote: > I want to parse bibtex file using flex/bison... A summary of BibTex can be found here: http://maverick.inria.fr/~Xavier.Decoret/resources/xdkbibtex/bibtex_summary.html#file_format According to the documentation found in the link above -you can have arbitrarily nested pairs of braces. -but braces must also be balanced inside quotes Provided the documentation above is accurate,one cannot describe with a regular grammar the quoted strings used in BibTex. Ev. Drikos [Quite right. The lexer would recognize them in chunks and the parser, which uses a pushdown automaton, puts them together. Or the other usual approach is a kludge with code in the lexer to count the braces and set start states that control what's returned. -John]