guile-user
[Top][All Lists]
Advanced

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

Re: Bytestructures: a "type system" for bytevectors


From: Matt Wette
Subject: Re: Bytestructures: a "type system" for bytevectors
Date: Mon, 20 Jun 2016 16:47:29 -0700

> On Jun 20, 2016, at 3:05 PM, Taylan Ulrich Bayırlı/Kammer <address@hidden> 
> wrote:
> [SNIP]
>  Would I have to write a C parser in Scheme, or can we cheat somehow?


scheme@(guile-user)> (use-modules (nyacc lang c99 parser))
scheme@(guile-user)> (use-modules (ice-9 pretty-print))
scheme@(guile-user)> (pretty-print (with-input-from-string "int printf(char 
*fmt, ...);" parse-c99))
(trans-unit
  (decl (decl-spec-list (type-spec (fixed-type "int")))
        (init-declr-list
          (init-declr
            (ftn-declr
              (ident "printf")
              (param-list
                (param-decl
                  (decl-spec-list (type-spec (fixed-type "char")))
                  (param-declr (ptr-declr (pointer) (ident "fmt"))))
                (ellipis)))))))

nyacc is an all-guile implementation of yacc and comes with a c99 parser, 
available from www.nongnu.org.   
The parser outputs parse trees in sxml format.   It is beta-level code.

Matt



reply via email to

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