From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nala Ginrut Newsgroups: gmane.lisp.guile.user Subject: Re: nyacc 0.65.0 released Date: Thu, 31 Dec 2015 12:11:37 +0800 Organization: HFG Message-ID: <1451535097.3594.47.camel@Renee-desktop.suse> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1451535132 15420 80.91.229.3 (31 Dec 2015 04:12:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 31 Dec 2015 04:12:12 +0000 (UTC) Cc: guile-user@gnu.org To: Matt Wette Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Thu Dec 31 05:12:03 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 1aEUao-0000k6-QM for guile-user@m.gmane.org; Thu, 31 Dec 2015 05:12:02 +0100 Original-Received: from localhost ([::1]:54599 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aEUak-0007rk-N9 for guile-user@m.gmane.org; Wed, 30 Dec 2015 23:11:58 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49210) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aEUab-0007rd-Aw for guile-user@gnu.org; Wed, 30 Dec 2015 23:11:50 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aEUaX-00078G-W6 for guile-user@gnu.org; Wed, 30 Dec 2015 23:11:49 -0500 Original-Received: from mail-pa0-x235.google.com ([2607:f8b0:400e:c03::235]:35563) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aEUaX-000783-QN for guile-user@gnu.org; Wed, 30 Dec 2015 23:11:45 -0500 Original-Received: by mail-pa0-x235.google.com with SMTP id ho8so1032353pac.2 for ; Wed, 30 Dec 2015 20:11:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:subject:from:to:cc:date:in-reply-to:references :organization:content-type:mime-version:content-transfer-encoding; bh=UZzZ0BKTudkzsgm39W9N3ps8qdJw/D6ueR0iH1bwR7I=; b=G+mRcMTDQjBPcfMfa7Bd4samQuUAnQ0ipAiPu9l+nh2ERH3Mx6CGFcbqoqAMMCy/2C +tGz/bAcTllxq6W6YGAWdQk/KtnixsGG8FbYDlb7wE2ZKnJnoaWQl/AL96sH+cKBKcEV AGpfX9bqDJGhSaqd5mSPAm1gUnGKfo8L1lq7WPps0CUXtp+W2mU1/i0hdjKVg1B0ifJp O9BoXssPFHy7fEXIJxiOY6lrosWlX+nFYPgJ30oCtJCIBJTlSYyowR2IHScrvnCNjZrg o1TBKgrsmJaSUduzwdqaParh4vEUVxooY2U7MuvjLx18zKcxt4pwEbUdhRwg4HaSFrZj tqyw== X-Received: by 10.66.141.165 with SMTP id rp5mr38810968pab.56.1451535105226; Wed, 30 Dec 2015 20:11:45 -0800 (PST) Original-Received: from [147.2.147.24] ([203.192.156.9]) by smtp.gmail.com with ESMTPSA id r83sm31521480pfa.13.2015.12.30.20.11.43 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 30 Dec 2015 20:11:44 -0800 (PST) In-Reply-To: X-Mailer: Evolution 3.4.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c03::235 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:12293 Archived-At: That's very nice! Thanks for all the work! This may provide new weapon for our multi-lang plan. And I saw C99 parser in your code, I think it's helpful for building a better FFI code generator, and parse C code directly. How's the javascript part? Is it completed one to cover ES6? And maybe it's good enough to replace our current ecmascript frontend? Writing parser for an industry language is painful, it's better to take advantage of *.y files which has been written by other people already. And save our time to cope with the IR and optimizing part. I still don't understand what's the meaning of gram.y in your project. Does nyacc use it? On Tue, 2015-12-29 at 13:01 -0800, Matt Wette wrote: > nyacc version 0.65.0 is released as beta > > nyacc is a LALR parser generator written from the ground up in guile > > Features/Updates: > * clean scheme-flavored syntax for grammar specification > * updated documentation (but still rough draft) > * prototype parsers for c, javascript, matlab that output parse trees in a SXML format > * partial sxml-parse-tree to il-tree conversion for javascript and C > * partial sxml-parse-tree pretty printer for javascript and C > > Demo: > Use C parser and pretty printer to clean up C expressions (e.g., remove unneeded paren’s): > > (use-modules (nyacc lang c99 pprint)) > (use-modules (nyacc lang c99 xparser)) > (use-modules (ice-9 pretty-print)) > > (let* ((st0 "(int)(((((foo_t*)0)->x)->y)->z)") > (sx0 (parse-cx st0 #:tyns '("foo_t"))) > (st1 (with-output-to-string (lambda () (pretty-print-c99 sx0)))) > (sx1 (parse-cx st1 #:tyns '("foo_t")))) > (simple-format #t "~S => \n" st0) > (pretty-print sx0 #:per-line-prefix " ") > (simple-format #t "==[pretty-print-c99]==>\n") > (simple-format #t "~S =>\n" st1) > (pretty-print sx1 #:per-line-prefix " “)) > > "(int)(((((foo_t*)0)->x)->y)->z)" => > (cast (type-name > (decl-spec-list (type-spec (fixed-type "int")))) > (i-sel (ident "z") > (i-sel (ident "y") > (i-sel (ident "x") > (cast (type-name > (decl-spec-list > (type-spec (typename "foo_t"))) > (abs-declr (pointer))) > (p-expr (fixed "0"))))))) > ==[pretty-print-c99]==> > "(int)((foo_t*)0)->x->y->z" => > (cast (type-name > (decl-spec-list (type-spec (fixed-type "int")))) > (i-sel (ident "z") > (i-sel (ident "y") > (i-sel (ident "x") > (cast (type-name > (decl-spec-list > (type-spec (typename "foo_t"))) > (abs-declr (pointer))) > (p-expr (fixed "0"))))))) > > http://download.savannah.gnu.org/releases/nyacc/ > or > git clone git://git.savannah.nongnu.org/nyacc.git