[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
nyacc 0.65.0 released
From: |
Matt Wette |
Subject: |
nyacc 0.65.0 released |
Date: |
Tue, 29 Dec 2015 13:01:19 -0800 |
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