unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Matt Wette <matthew.wette@verizon.net>
To: guile-user@gnu.org
Subject: nyacc 0.65.0 released
Date: Tue, 29 Dec 2015 13:01:19 -0800	[thread overview]
Message-ID: <E5B417BB-1578-4FE3-8B61-ABAD9FA455B6@verizon.net> (raw)

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


             reply	other threads:[~2015-12-29 21:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-29 21:01 Matt Wette [this message]
2015-12-30 14:35 ` nyacc 0.65.0 released Ludovic Courtès
2015-12-30 16:54   ` Matt Wette
2015-12-30 17:38     ` Ludovic Courtès
2015-12-30 20:58     ` Christopher Allan Webber
2015-12-30 21:32       ` Matt Wette
2015-12-31  4:11 ` Nala Ginrut
2015-12-31 15:21   ` Matt Wette
2015-12-31 17:22     ` Matt Wette

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E5B417BB-1578-4FE3-8B61-ABAD9FA455B6@verizon.net \
    --to=matthew.wette@verizon.net \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).