[qcc] Fwd: qcc latest version

Bruce Ewing bewing0 at gmail.com
Sat Sep 16 14:55:36 PDT 2017


When I talked to Rob about the original qcc project, I basically found that
there are some licensing issues -- because there was additional code in
tinycc that Fabrice did not have permission to relicense. We basically
agreed that starting over with a complete rewrite and a new license was
likely to be the best path.

When you start over, of course that brings in the concept of making some
fairly major design choices. Rob wants to leverage the backend of QEMU
(TCG) that was written by Fabrice, and turn it into the backend for qcc. I
looked at that code, and the output is not sufficiently optimized for my
purposes. Rob doesn't particularly want optimization, but I have a register
allocation process that I absolutely want implemented in the copy of the
compiler that I run.

So to get what we both want, I figured I'd make the code modular. So the
frontend tokenizes the code very efficiently, and then you pick your own
backend to convert the tokenized stream into machine code. He can pick the
QEMU backend, and I can pick my optimizing backend. If I give everybody a
functional fast tiny C compiler with a BSD/MIT/CC0 license, then they can
spend a small amount of time tweaking their chosen backend to suit their
purposes.

I got 95% of the way toward tokenizing the input C code, but I got stuck
deciding how to process the infinitely deep recursions of new instances of
anonymous structs being declared inside typedefs inside function
declarations, with struct elements based on typedefs containing other
struct definitions, .... Infinitely deep recursions are always a problem,
but when I looked deeply into it, this particular aspect of ANSI C explodes
in a really ugly way.

But since I do not have a fully tokenized input stream, I could not
effectively create the backends or the interfaces to them.

So what I am currently doing is creating a simplified language that does
not allow that sort of circular struct/typedeffing. I am building a
compiler for that, which will allow me to finish writing the interface to
the backends, and the interface between the frontend and the backends. Once
I have those parts built, tested, and running, and I know exactly what I
need the inputs to look like -- then I can go back and create some sort of
kludge for dealing with the struct/typedef recursion mess -- probably in an
incomplete way.

But yes, tl;dr -- I got stuck in the way I was approaching it logically,
and it's going to take me a while longer.

Bruce Ewing
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/qcc-landley.net/attachments/20170916/0a18dcf5/attachment.htm>


More information about the qcc mailing list