From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6152 invoked by alias); 8 Apr 2010 20:21:57 -0000 Mailing-List: contact archer-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: List-Id: Received: (qmail 6143 invoked by uid 22791); 8 Apr 2010 20:21:55 -0000 X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_LR,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Message-ID: <4BBE3AD8.2030202@redhat.com> Date: Thu, 08 Apr 2010 20:21:00 -0000 From: Chris Moller User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1b3pre) Gecko/20090513 Fedora/3.0-2.3.beta2.fc11 Thunderbird/3.0b2 MIME-Version: 1.0 To: Tom Tromey CC: Sergio Durigan Junior , Project Archer Subject: Re: Parser rewritting References: <201003301546.34866.sergiodj@redhat.com> <4BB54D69.1000009@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2010-q2/txt/msg00004.txt.bz2 On 04/08/10 15:21, Tom Tromey wrote: > Chris> A lot of years ago I wrote a fairly elaborate parser using > Chris> antlr--definitely a cool tool and I recommend you consider it. > > One thing to ensure is that the antlr output is GPL-compatible. > If not, we can't use it. > antlr.org says that ANTLR itself is under "The BSD License," which looks to like a small subset of GPLv2, but IANAL. I couldn't find anything about licensing for the generated code. http://www.antlr.org/wiki/display/Mantra/License > Chris> Just as an example, I've attached a rudimentary antlr grammar that > Chris> parses a subset of C/C++ decls > > We only need expressions. > > Chris> Anyway, it's probably worth considering. > > While I still think it makes the most sense to mimic g++, I am open to > other solutions that are powerful enough. > > Another thing worth considering is bison's GLR mode. This has the > advantage that we wouldn't actually need to rewrite the whole parser, we > could just start by tweaking it. > > Using tools that generate code is problematic in GDB, because people > complain about every new dependency. Even requiring bison will probably > generate complaints, because AFAIK some people still do their builds > with byacc. Maybe we could check in the generated code, though. > With one exception, ANTLR, including v3, under at least Fedora--I don't know about RHEL. The exception is the v3 C target-language support, which I had to install separately, but I expect it could be included in the antlrv3 package. The generated code is kinda big. The source for the antlr C/C++ expression parser I wrote totals 737 lines, about 500 of which is C support code--the antlr grammar is only 239 lines. But that 239 lines gets turned into about 8800 lines of combined lexer and parser. > Tom >