From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3480 invoked by alias); 23 Oct 2004 00:39:42 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 3472 invoked from network); 23 Oct 2004 00:39:41 -0000 Received: from unknown (HELO x93.infopact.nl) (212.29.160.93) by sourceware.org with SMTP; 23 Oct 2004 00:39:41 -0000 Received: from steven.lr-s.tudelft.nl (70-90.ipact.nl [82.210.90.70]) by x93.infopact.nl (8.12.10/8.12.10) with ESMTP id i9N0dfF3025049; Sat, 23 Oct 2004 02:39:41 +0200 From: Steven Bosscher To: "Joseph S. Myers" , gcc-patches@gcc.gnu.org Subject: Re: New C parser [patch] Date: Sat, 23 Oct 2004 02:39:00 -0000 User-Agent: KMail/1.5.4 References: In-Reply-To: Organization: SUSE Labs MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200410230240.19708.stevenb@suse.de> X-CanItPRO-Stream: NoScan X-Spam-Score: undef - spam-scanning disabled X-Canit-Stats-ID: 1237426 - 99788e88a9c9 X-Scanned-By: CanIt (www . canit . ca) X-SW-Source: 2004-10/txt/msg01973.txt.bz2 On Saturday 23 October 2004 01:56, Joseph S. Myers wrote: > Writing a C parser is quicker than reading, analysing and replying to > hundreds of list messages discussing how to implement OpenMP and what > should or should not be replaced to do so, so I just wrote one over > the past week. This is a hand-written, recursive-descent parser for C > that parses the same GNU C language as the Bison parser, just > replacing the parser and not other code at the same time. Very, very cool. Quickly looked over it, only one remark so far: > + /* Parse old-style parameter declarations. */ > + while (c_lexer_next_token_is_not (parser->lexer, CPP_EOF) > + && c_lexer_next_token_is_not (parser->lexer, CPP_OPEN_BRACE)) > + c_parser_declaration_or_fndef (parser, false, false, true, false); > + DECL_SOURCE_LOCATION (current_function_decl) = input_location; Don't you want to make the location of current_function_decl the first line where the function definition starts (or the location of the first token even)? Gr. Steven