guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: nyacc 0.65.0 released


From: Nala Ginrut
Subject: Re: nyacc 0.65.0 released
Date: Thu, 31 Dec 2015 12:11:37 +0800

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]