guix-devel
[Top][All Lists]
Advanced

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

Re: Binding generator, for Guile, to C libraries


From: Ludovic Courtès
Subject: Re: Binding generator, for Guile, to C libraries
Date: Wed, 05 Jul 2017 23:53:36 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

Hello,

Danny Milosavljevic <address@hidden> skribis:

> Okay, I've cleaned up what I have and put it on github, under:
>
> https://github.com/daym/guile-gcc-unit
>
> What this does is it allows you to read gcc output files which specify all 
> the prototypes - in our case in order to extract the prototypes and generate 
> Guile bindings (of parted, or whatever).
>
> The next steps:
> - Provide the actual binding generator (I started a version of it - I'll 
> commit a cleaned-up version in a few days I guess).
> - Get it to work with non-toy examples (see file "tests/huge/input" for the 
> parted non-toy example - the goal is to read this file, find all the record 
> decls and all the function decls in it and generate the Guile pendants of 
> them).  If you happen to know LALR parsing theory, I have a question :)
> - Find out whether that can be integrated as a Guile "language".  Just being 
> able to do something like ',load "foo.h"' and have it register all the 
> functions from it would be way cool.  On the other hand, on non-Guix systems 
> the header files aren't usually installed when the library is installed.  So 
> maybe an offline version would be good as well.

Matt Wette, the author of nyacc, was apparently in the process of
writing a similar tool using nyacc’s C99 parser.  Might be worth looking
at.

Besides and FWIW, I’m skeptical of binding generators.  Things like
SWIG, for instance, generate interfaces that are often not quite what
you’d like, so you end up writing a layer on top of the generated glue
anyway, not to mention annotation in headers.  (Bindings generated from
high-level descriptions like GIR and XCB are a different story; those
seem to work quite well.)

That said, you might want to share on address@hidden to get feedback!

Ludo’.



reply via email to

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