From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Christopher Allan Webber Newsgroups: gmane.lisp.guile.user Subject: Re: nyacc 0.65.0 released Date: Wed, 30 Dec 2015 14:58:25 -0600 Message-ID: <878u4b3acs.fsf@dustycloud.org> References: <87wprwuhpw.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1451510277 17480 80.91.229.3 (30 Dec 2015 21:17:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 30 Dec 2015 21:17:57 +0000 (UTC) Cc: Ludovic =?utf-8?Q?Court=C3=A8s?= , guile-user@gnu.org To: Matt Wette Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Wed Dec 30 22:17:56 2015 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aEO82-00032D-4z for guile-user@m.gmane.org; Wed, 30 Dec 2015 22:17:54 +0100 Original-Received: from localhost ([::1]:53801 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aEO81-0003qY-I0 for guile-user@m.gmane.org; Wed, 30 Dec 2015 16:17:53 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60816) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aEO7K-0002tz-KF for guile-user@gnu.org; Wed, 30 Dec 2015 16:17:11 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aEO7I-0001ys-TT for guile-user@gnu.org; Wed, 30 Dec 2015 16:17:10 -0500 Original-Received: from dustycloud.org ([2600:3c02::f03c:91ff:feae:cb51]:51788) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aEO7I-0001yf-OG; Wed, 30 Dec 2015 16:17:08 -0500 Original-Received: from oolong (localhost [127.0.0.1]) by dustycloud.org (Postfix) with ESMTPS id 0BA9126722; Wed, 30 Dec 2015 16:17:06 -0500 (EST) In-reply-to: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2600:3c02::f03c:91ff:feae:cb51 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 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-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:12291 Archived-At: Matt Wette writes: > On Dec 30, 2015, at 6:35 AM, Ludovic Court=C3=A8s wrote: >>> Demo: >>> Use C parser and pretty printer to clean up C expressions (e.g., remo= ve unneeded paren=E2=80=99s): >>=20 >> The demo is already quite impressive! > > Thanks. I agree. Holy damn, this looks incredible. >> What subset of C99 and GNU99 is currently supported? > > I can=E2=80=99t remember if any C99 items are not in. I do not have an= y GNU99 > extensions in there. However, this is not a faithful parser for C99. > The purpose is not to compile, but to generate translators and > auto-coders. I have built the parser with the following features: > 1) The c-preprocessor parsing is merged in with the lexical analyzer. > 2) The parse tree is =E2=80=9Cfile oriented=E2=80=9D, so that you can t= rack what > elements are in the top-level file. > 3) The parser will parse comments. > > so > #ifdef ABC > #include =E2=80=9Cxyz.h=E2=80=9D > #endif > foo_t x; /* this is a decl */ > > comes out > (trans-unit > (cpp-stmt (if (defined "ABC"))) > (cpp-stmt > (include > "\"xyz.h\"" > (trans-unit > (decl (decl-spec-list > (stor-spec (typedef)) > (type-spec (fixed-type "int"))) > (init-declr-list (init-declr (ident "foo_t"))))))) > (cpp-stmt (endif)) > (decl (decl-spec-list (type-spec (typename "foo_t"))) > (init-declr-list (init-declr (ident "x"))) > (comment " this is a decl "))) > > and the pretty-printer generates > #if defined(ABC) > #include "xyz.h" > #endif > foo_t x; /* this is a decl */ Still super cool. >> What are you aiming for with the tree-il conversion? That sounds >> interesting. :-) > > The purpose of the tree-il conversion is to support =E2=80=9C,L =E2=80=9D at > the guile prompt. And the tree-il code is done for javascript and a > simple calculator, not C. I just tried the javascript and it is not > working, but here is a small demo with the simple calculator. The > calc files (parser, compiler and spec) are included below. > > scheme@(guile-user)> ,L calc > Happy hacking with calc! To switch back, type `,L scheme'. > calc@(guile-user)> a =3D 3 + 4 > calc@(guile-user)> ,L scheme > Happy hacking with Scheme! To switch back, type `,L calc'. > scheme@(guile-user)> a > $1 =3D 7 That's really interesting. Do you have more specific applications in mind beyond this?