GCC front-ends
GCC front-ends
Posted Jan 1, 2025 18:30 UTC (Wed) by jklowden (guest, #107637)In reply to: GCC front-ends by ibukanov
Parent article: An Algol 68 front end for GCC
Those years ago, I wanted to use clang to parse C++, and write the metadata to a database. I left with the sense that it might be possible, but I'd have to write the manual first.
(I still *do* want to write that tool. It would underpin a source-code navigation tool for C++, something that doesn't exist for large code bases. We have C-based tools like GNU Global and cscope, and I remember using a web-based text-search engine, but nothing that could distinguish open(2) from std::stream::open(), or report the call stack that modifies a variable.)
The GCC Internals manual runs some 800 pages. Even at that, the 10% of that document devoted to front-end development woefully inadequate; after all, the ISO COBOL specification is 1280 pages, and it describes only one language. But that document, plus a tutorial example, gave us a toehold. Within a week we had the "hello world" version of a COBOL compiler. Then it was just a quick 8 or so man-years of work.
Posted Jan 1, 2025 19:07 UTC (Wed)
by linuxrocks123 (subscriber, #34648)
[Link]
Posted Jan 1, 2025 22:32 UTC (Wed)
by ejr (subscriber, #51652)
[Link]
Both systems have their benefits and drawbacks. Neither "wins." What we had to do would have been much more painful in GCC for various reasons. But so was the forward porting. meh. That's why we're "engineers," right?
Posted Jan 2, 2025 14:58 UTC (Thu)
by iabervon (subscriber, #722)
[Link]
Posted Jan 4, 2025 23:31 UTC (Sat)
by geofft (subscriber, #59789)
[Link]
This is the opposite of what you're looking for, to be fair; I wanted to use LLVM's compilation backend with a non-C language, and you wanted to use Clang's C parser. But there is a libclang tutorial that looks brief and readable that might be what you wanted. (Perhaps it did not exist at the time.)
GCC front-ends
GCC front-ends
GCC front-ends
I found the LLVM tutorial excellent when I was going through it recently - I got a working AOT compiler for a tiny subset of Python going in a couple of hours.
GCC front-ends
