> On Jun 20, 2016, at 3:05 PM, Taylan Ulrich Bayırlı/Kammer
> <[email protected]> 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