From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Matt Wette Newsgroups: gmane.lisp.guile.user Subject: Re: nyacc 0.73.0 released Date: Sat, 31 Dec 2016 07:57:01 -0800 Message-ID: References: <87d1gfcfnm.fsf@gnu.org> <87r34ob2wc.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 (Mac OS X Mail 10.2 \(3259\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1483199859 1080 195.159.176.226 (31 Dec 2016 15:57:39 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 31 Dec 2016 15:57:39 +0000 (UTC) Cc: guile-user@gnu.org To: Jan Nieuwenhuizen Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sat Dec 31 16:57:35 2016 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cNM2B-00077c-8D for guile-user@m.gmane.org; Sat, 31 Dec 2016 16:57:27 +0100 Original-Received: from localhost ([::1]:44613 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cNM2F-0007wH-SB for guile-user@m.gmane.org; Sat, 31 Dec 2016 10:57:31 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34975) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cNM1v-0007wC-GR for guile-user@gnu.org; Sat, 31 Dec 2016 10:57:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cNM1u-0004FT-Hi for guile-user@gnu.org; Sat, 31 Dec 2016 10:57:11 -0500 Original-Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]:33869) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cNM1q-0004DR-Lv; Sat, 31 Dec 2016 10:57:06 -0500 Original-Received: by mail-pg0-x244.google.com with SMTP id b1so25402236pgc.1; Sat, 31 Dec 2016 07:57:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=dnG/s0v24n7Iqx3Hv+zoiEraumSYItQz02BwTah89G4=; b=L0C+n6UBFtrlrW48LpKcfZgkABGzMAQa4DteZ29WPsaKwbdWutxXg7RR+Pewqh6buK D83bSPg1M2fU9gJAZYVipFdbFMI/1/BNxazLcRJjIkjtsAc88MsyN0tOOq9oxlvOwMtY r0tMmxC5lC7lDGr3pgRl3YYfXgeFRBKNUDv5lN6nfyKg0vb95BNUa6euy2gsjTt/lwaU YbrHHjGCBFczhR4bIi3LuCYhp4xHJEyfNmrwMUCUwaPv4I3IA+DB9n/xB/ZrZMNEIehH C1jU+M21hK6n3cvSs/qIOpC5Ftpfxf3dAiY17LdYS2ULVZlso8GoISMcp+flgq81XxTx a6IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=dnG/s0v24n7Iqx3Hv+zoiEraumSYItQz02BwTah89G4=; b=BIpFBv4zpBOhskTuGsRMXTtwhnCxK7Upk0PiuLUsKgCZEIuJ4+m6vDxXJGqzXSw7Xi fc3ksKySSVYCJ0aQPhPAlNbgG/ODb19vpqKZ4in1M5rgRA4oQQyTxwK35vFWp3GK4KDx C+n72SLsfvrV7kPFMVQOMyhusCuYOUeK2UY4nD8KUDYJrp6aB4EO555FG2nc5arwa4pC 7zoREbsYCUpkwQKvPngZho8z7ldyj6j78V1i78pOG+SLJk+WZi6sP6g2N9rIdTCdYOkF YMOk+3g0N6bL5Qh/Kuna1BdTuuDsRy8ePNyiupw70tyPZLbCz6Rs6WO19tkCE5+XxBqs mLcw== X-Gm-Message-State: AIkVDXLzI01stoXWDLfALuUWbsDpJzDBBO991N8rktztHRCAzAwPyT4Hd/tDjVnjpJwFFw== X-Received: by 10.84.232.197 with SMTP id x5mr74606457plm.102.1483199824696; Sat, 31 Dec 2016 07:57:04 -0800 (PST) Original-Received: from nautilus.championbroadband.com (216-165-246-244.championbroadband.com. [216.165.246.244]) by smtp.gmail.com with ESMTPSA id l7sm120714374pfg.35.2016.12.31.07.57.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 31 Dec 2016 07:57:03 -0800 (PST) In-Reply-To: <87r34ob2wc.fsf@gnu.org> X-Mailer: Apple Mail (2.3259) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c05::244 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:13068 Archived-At: > On Dec 31, 2016, at 6:15 AM, Jan Nieuwenhuizen = wrote: >=20 > Matt Wette writes: >=20 >> I believe C99 parser is complete. There may be errors, but I think >> all the elements are there. >=20 > Great! As it turns out, I was using some GNU extensions (anonymous > unions inside structs. >=20 > I have now picked-up my work on Mes's simple C compiler backend, using > Nyacc. I have already replaced my LALR parser with Nyacc's AST[0]. >=20 > How far is the Nyacc's C99 preprocessor? I have two problems with it. >=20 > It would be very helpful if it would disregard anything inside a false > conditional directive. It seems I cannot conditionally comment things > out that Nyacc does not parse, like >=20 > --8<---------------cut here---------------start------------->8--- > #if __GNUC__ > void > _start () > { > puts ("Hello micro-mes!\n"); >=20 > ///int r =3D main (0,0); > int r; > asm ( > "push $0\n\t" > "push $0\n\t" > "call main\n\t" > "movl %%eax,%0\n\t" > : "=3Dr" (r) > : //no inputs "" (&main) > ); > #endif // GNUC > --8<---------------cut here---------------end--------------->8--- >=20 > =3D=3D> micro-mes.c:199: parse failed at state 379, on input =E2=80=9C:= " I need to document better. There is an argument to handle this. I = think this may accomplish what you want: (define (my-xdef? name mode) (if (equal? name =E2=80=9C__GNUC__=E2=80=9D) = #f (env? mode =E2=80=98code)) (parse-c99 #:xdef? my-xdef? =E2=80=A6) > headers that Nyacc does not parse, like , which is > a bit of a pain. (define my-td-dict =E2=80=98((=E2=80=9Cassert.h=E2=80=9D))) (parse-c99 #:td-dict my-td-dict =E2=80=A6) See std-dict in nyacc/lang/c99/body.scm. This is added by default, but = should probably not be. td-dict is an a-list of include files with typedefs in those files. >=20 > Also, it seems like it doesn't like it if an #includ'ed file is meant = to > go inside a function, like (simplified example) >=20 > --8<---------------cut here---------------start------------->8--- > // main.i > r =3D 3; > --8<---------------cut here---------------end--------------->8--- >=20 > --8<---------------cut here---------------start------------->8--- > // main.c > int > main () > { > int r; > #include "main.i" > return r; > }=20 > --8<---------------cut here---------------end--------------->8--- >=20 >=20 > =3D=3D> ./main.i:2: parse failed at state 43, on input =E2=80=9Cr" This seems like a bug to me. I will check it out.