[RFC 00/29] RFC: Generate object-model code based on relax-ng files

Andrea Bolognani abologna at redhat.com
Wed Apr 22 12:49:01 UTC 2020


On Wed, 2020-04-22 at 10:45 +0100, Daniel P. Berrangé wrote:
> On Wed, Apr 22, 2020 at 11:37:23AM +0200, Andrea Bolognani wrote:
> > On Wed, 2020-04-22 at 09:48 +0100, Daniel P. Berrangé wrote:
> > > I wonder if we can refactor that tool to extract the code for parsing into
> > > a module, so that we can more reasily re-use it for both the API docs and
> > > for a new XML generator
> > 
> > Or we could replace that C parsing code with something based on
> > libclang.
> 
> I think that's a double edged sword. While it gives you the full coverage
> of the C language, you then have to deal with the full range of the C
> language. I think the simplified parser we have for the docs build will
> be easier to work with by being more constrained in what it tries to
> support.

Glancing at the ~2000 lines of Python used to parse C doesn't
necessarily give me the same impression :) But then again, in all
fairness I have no idea how complicated an equivalent tool that uses
libclang would be.

> > Either way, if this ever becomes usable I think it should not live
> > in the libvirt repository but be a standalone tool instead, as I can
> > see many projects potentially benefiting from it.
> 
> Yes, but we can worry about that at a later date IMHO.

Absolutely! Let's just keep this goal in mind, and try to make it
reasonably generic instead of hardcoding libvirt-concepts in it.

> > Which begs the question: are we absolutely certain something like
> > this doesn't exist already? We should make sure that's really the
> > case before we invest time on it...
> 
> I've not found anything equivalent to Golang's XML parser for C

Hopefully the tool we're thinking of is not just hidden in some
random person's GitHub account :)

-- 
Andrea Bolognani / Red Hat / Virtualization




More information about the libvir-list mailing list