EDG C++ front-end goes public
Thread
Loading the complete thread in the background. This saved snapshot is available now. Refresh
Unofficial Hacker News client; not affiliated with Y Combinator.
EDG C++ front-end goes public
Loading the complete thread in the background. This saved snapshot is available now. Refresh
Unofficial Hacker News client; not affiliated with Y Combinator.
my-next-account · · focus · HN ↗
OneDeuxTriSeiGo · · focus · HN ↗
TLDR EDG C++ is a compiler frontend developed by EDG since the 80s which has been used under the hood for a whole bunch of commercial C and C++ compilers, static analyzers, linters, and IDE code completion tools.
Odds are if you are familiar with a closed source tool in one of those categories above, there's a decent chance it uses EDG's frontend somewhere in it under the hood.
dgrunwald · · focus · HN ↗
The "frontend" is the part of the compiler that understands the input language: lexer, parser, template instantiation, constexpr evaluation, ... The EDG frontend produces an intermediate representation (IL) that is then used by the different compiler vendors to generate machine code. Or do code analysis.
EDG can also be used as a C++-to-C compiler.
ur-whale · · focus · HN ↗
Nice to see this still exists!
After all, this is how it all started back in the days of - what was it called again ? - yeah, cfront
<a href="https://en.wikipedia.org/wiki/Cfront" rel="nofollow">https://en.wikipedia.org/wiki/Cfront
tgma · · focus · HN ↗
daveedvdv · · focus · HN ↗
OneDeuxTriSeiGo · · focus · HN ↗
The source code itself: <a href="https://github.com/edgcpp/compiler" rel="nofollow">https://github.com/edgcpp/compiler
Documentation: <a href="https://edgcpp.org/doc/" rel="nofollow">https://edgcpp.org/doc/
And for those curious the license SPDX is: Apache-2.0 WITH LLVM-exception
i.e.
- <a href="https://spdx.org/licenses/Apache-2.0.html" rel="nofollow">https://spdx.org/licenses/Apache-2.0.html
- <a href="https://spdx.org/licenses/LLVM-exception.html" rel="nofollow">https://spdx.org/licenses/LLVM-exception.html
throwaway2037 · · focus · HN ↗
jcranmer · · focus · HN ↗
rramadass · · focus · HN ↗
daveedvdv · · focus · HN ↗
rramadass · · focus · HN ↗
Just for others: Again from <a href="https://www.edg.com/c" rel="nofollow">https://www.edg.com/c
suid · · focus · HN ↗
EDG was just 3 guys back then.
criemen · · focus · HN ↗
daveedvdv · · focus · HN ↗
Steve Adamczyk, the founder, told me that he created the company to be able to enjoy his work rather than to grow it into something that would rob him of that joy (I hope I paraphrase it right): He is an awesome human!
rramadass · · focus · HN ↗
This is what i want to do in my life too!
vintagedave · · focus · HN ↗
For background -- and I am not an expert here -- their C++ frontend is widely known. I first heard of it because Visual C++'s Intellisense uses it, which was notable because VC does not use the msvc frontend for its own completion. I understand it's been either used or evaluated for other frontends in the past too. I worked as PM for one C++ product, and was fortunate to be able to learn a lot from our engineers; we didn't use it, but they thought highly of EDG.
It has a very strong reputation for being correct. And as such, I think open sourcing it will be a very beneficial thing for the C++ community.
carterschonwald · · focus · HN ↗
lelanthran · · focus · HN ↗
But also quite sad. They've announced that they are closing down.
genxy · · focus · HN ↗
bigbuppo · · focus · HN ↗
alex_suzuki · · focus · HN ↗
pjmlp · · focus · HN ↗
genxy · · focus · HN ↗
JBits · · focus · HN ↗
genxy · · focus · HN ↗
To make up for my transgression ...
Here is Doom in Cobol tho <a href="https://github.com/deios0/cobol-doom" rel="nofollow">https://github.com/deios0/cobol-doom
Rock Paper Scissors in Cobol as a Cloudflare Worker <a href="https://github.com/cloudflare/cobol-worker/blob/master/src/worker.cob" rel="nofollow">https://github.com/cloudflare/cobol-worker/blob/master/src/w...
pjmlp · · focus · HN ↗
jcranmer · · focus · HN ↗
The reason why the EDG frontend is being open-sourced is because EDG itself is closing up shop, and the open sourcing is an interim solution as EDG's customers work on migrating to using Clang instead. So... it's really not good news, because it means that one of the frontends is basically reaching end-of-life.
vintagedave · · focus · HN ↗
whobre · · focus · HN ↗
tialaramex · · focus · HN ↗
pjmlp · · focus · HN ↗
Now if they upstream the changes is another matter.
crote · · focus · HN ↗
From what I can tell this is just some retiring guys who want to make sure their life's work isn't lost to history, and who want to avoid screwing over their handful of remaining customers. Realistically, the best you can hope for is probably the occasional bugfix, and other open-source compilers scavenging it for a handful of useful clever ideas.
whizzter · · focus · HN ↗
Why not defect to clang? I'm sure some PHB's will suggest that (and that will be part of the survival, convincing those that supporting another party is a good thing).
Standardization does have it's issues, but the JS ecosystem always seems to be healthier when one implementation isn't too dominant. The question is if the C++ ecosystem is large enough to support multiple frontends.
crote · · focus · HN ↗
Having your resident compiler expert upstream the occasional patch to keep your legacy product from dying is one thing, but which big tech company cares about this specific compiler enough to spin up an entirely new dedicated team for it? And who's going to choose a mostly-abandoned compiler front-end as a core part of a new product?
neutronicus · · focus · HN ↗
whizzter · · focus · HN ↗
I think that's the point of the whole point of a nonprofit stewardship, that a few developers each from the main customers can come together and cooperate well enough on the upstream that they don't have to take the entire cost of changing downstream to Clang or maintaining a frontend.
fg137 · · focus · HN ↗
daveedvdv · · focus · HN ↗
fg137 · · focus · HN ↗
badsectoracula · · focus · HN ↗
[0] <a href="https://github.com/open-watcom/open-watcom-v2" rel="nofollow">https://github.com/open-watcom/open-watcom-v2
jcranmer · · focus · HN ↗
(and I'm implicitly using C++11 here when I say "C++", given that it effectively defines 'modern' C++).
badsectoracula · · focus · HN ↗
whizzter · · focus · HN ↗
Adding some features of C++11 isn't close to building a C++ compiler capable of 11, 14, let alone 17, 20, 23 or 26.
If you can rip out a compliant parser, it might even be better to start over on a new compiler frontend if your current compiler frontend is targeting at pre-11 level.
kvuj · · focus · HN ↗
quuxplusone · · focus · HN ↗
AlotOfReading · · focus · HN ↗
quuxplusone · · focus · HN ↗
Actually I take that back. At the dawn of time (1982), GHS definitely had its own frontend. They switched to EDG sometime before my time. I meant I'd be surprised to learn they'd switched from EDG to something home-grown.
This also meant that in my time there was a hefty "glue" layer between the EDG frontend and the GHS middle-end (the middle-end being the tree transformations and "indep" optimizations before you got into the back-end stuff): you had to take the structures EDG produced and turn them into the structures the GHS middle-end wanted.
I was there right when John Regehr's Csmith was first making big waves. We started using it, and also rolled our own fuzzer with more focus on embedded-software trouble spots, such as `volatile` and `packed` and I forget what else. (Guy Goldstein originated and led this, as I recall.) I don't actually remember the fuzzer finding a lot of crashes, but maybe it did, and I do remember its finding a lot of miscompilations, i.e., bad optimizations.
Xirdus · · focus · HN ↗
jcranmer · · focus · HN ↗
apaprocki · · focus · HN ↗
fithisux · · focus · HN ↗
andikleen2 · · focus · HN ↗
TachyonProducti · · focus · HN ↗
For most of C++'s life, "independent front-ends" was a talking point, but in practice EDG was the tiebreaker — the implementation that tracked the working draft fastest, and whose disagreement usually meant the others' bug. Anyone who hit a template-heavy corner knew the ritual: strip it down, throw it at the Comeau online compiler, and see whether EDG agreed with you or with your local compiler.
Now that ritual is a clone and a build away, and "works on 3 of 4 front-ends" can become an actual CI check instead of folklore. That's rarer than it sounds: most languages don't have an independent second implementation of the whole language, let alone a fourth. Whatever happens with maintenance, having the reference parsing of C++ readable and runnable is a gift to everyone who ever had to argue about what the standard actually means.
cyberax · · focus · HN ↗
It looks weird, but it actually makes sense! The flow is more natural - first the function definition, and then the explanation of what it does. It also avoids repeating the function name.
mhh__ · · focus · HN ↗
zerr · · focus · HN ↗
bobmarleybiceps · · focus · HN ↗
void func(var1, var2) int var1, char* var2. { ... }
perhaps some legacy from that? Probably not, but just first thing that popped into my head since it feels similar :shrug:
1718627440 · · focus · HN ↗
spatulon · · focus · HN ↗
compiler-guy · · focus · HN ↗
So it came up in an era where folks were inventing their own style and the huge homogenizing influence of the gnu standards (and other open source projects) hadn't taken hold.
I like it. It feels like another language, and has its advantages. I really like to know of alternate ways of doing things, even if I don't adopt them myself.
RossBencina · · focus · HN ↗
I think Indian Hill (C, not C++) was the first one I ever read: <a href="https://www2.cs.arizona.edu/~mccann/cstyle.html" rel="nofollow">https://www2.cs.arizona.edu/~mccann/cstyle.html
Looks like there is an updated version (1997) here: <a href="https://www.cs.cornell.edu/people/egs/comp303/tutorials/cstyle.pdf" rel="nofollow">https://www.cs.cornell.edu/people/egs/comp303/tutorials/csty...
Paul Haeberli's "The SGI C Source Compliance Requirements" is hard to forget: <a href="https://www.graficaobscura.com/ccode/index.html" rel="nofollow">https://www.graficaobscura.com/ccode/index.html
I wonder whether there is a centralised historical archive of C/C++ style guides?
The modern staples are covered here, I guess:
<a href="https://github.com/kciter/awesome-style-guide#cpp" rel="nofollow">https://github.com/kciter/awesome-style-guide#cpp
asveikau · · focus · HN ↗
RossBencina · · focus · HN ↗
jabl · · focus · HN ↗
(Using FORTRAN here rather than the more correct Fortran to denote the traditional pre-modern (Fortran 90+) programming style.)
stuaxo · · focus · HN ↗
EDIT: But in this case it seems something significant is being released, it would be better with less writing and more human if possible.
j16sdiz · · focus · HN ↗
llm overused them, but llm got its training data from catchy marketing materials and youtubers
pjmlp · · focus · HN ↗
zeven7 · · focus · HN ↗
_flux · · focus · HN ↗
I find it extremely unlikely LLMs would have the monopoly on this word arrangement—and indeed they would have learned it from training material produced by people in the first place.
dgrunwald · · focus · HN ↗
Where other languages might use inheritance, EDG still uses the C-style `union { ... } variant;`.
On a related note, compiling EDG is extremely fast: on my machine, the EDG frontend compiles in <10s; whereas clang takes >10min (caution unfair comparison: clang includes much more than just a frontend).
smlacy · · focus · HN ↗
waynecochran · · focus · HN ↗
criemen · · focus · HN ↗
trebligdivad · · focus · HN ↗
kccqzy · · focus · HN ↗
pjmlp · · focus · HN ↗
One of EDG developers prototyped his idea, and brought it to WG21 when it seemed reflection as originally thought for C++17 was never happening.
bluGill · · focus · HN ↗
Imagine telling your competitors not to copy some feature you have and them listening!
crackez · · focus · HN ↗
daveedvdv · · focus · HN ↗
crackez · · focus · HN ↗
His wife Anne was one of my professors as well (Cobol). I promised her I would never get a job writing Cobol. Unbroken.
Incredibly smart people...
daveedvdv · · focus · HN ↗
KerrAvon · · focus · HN ↗
keyle · · focus · HN ↗
butterisgood · · focus · HN ↗
crackez · · focus · HN ↗
etyp · · focus · HN ↗
Looking back at that code definitely brings back memories. As a consumer of both frontends, I will say I much preferred working with Clang's. Both needed extra work on top to support everything we needed. Maybe I'm just not as acquainted with C as I would like to be. It's cool to look at this again, though.
vintermann · · focus · HN ↗
jabl · · focus · HN ↗
<a href="https://en.wikipedia.org/wiki/Edison_Design_Group" rel="nofollow">https://en.wikipedia.org/wiki/Edison_Design_Group ref 9: <a href="https://herbsutter.com/2025/11/10/trip-report-november-2025-iso-c-standards-meeting-kona-usa/" rel="nofollow">https://herbsutter.com/2025/11/10/trip-report-november-2025-...
whobre · · focus · HN ↗
splicebot · · focus · HN ↗
whizzter · · focus · HN ↗
MFHava · · focus · HN ↗
vlovich123 · · focus · HN ↗
Yes, but no reflection on the burn out this causes for the c++ community?
watinthedeutsch · · focus · HN ↗
daveedvdv · · focus · HN ↗
fg137 · · focus · HN ↗
layer8 · · focus · HN ↗
throwaway2037 · · focus · HN ↗
feelamee · · focus · HN ↗
daveedvdv · · focus · HN ↗
throwaway2037 · · focus · HN ↗
piker · · focus · HN ↗
compiler-guy · · focus · HN ↗
It isn't perfect, but it is awfully good.
Another interesting thing is that in 1999ish, when SGI open-sourced the Irix compiler (known as sgicc) into open-64, the it used a terribly hacked version of gcc as a front end to generate its internal intermediate representation.
This was because sgicc, even back then, used EDG as a front end, and EDG wasn't open and couldn't be opened up at the time.
The combination worked OK, but was pretty hacky, and I wonder if open64 would have gotten more traction than it did if it had been able to use EDG, or perhaps some other front end actually designed as a front end instead of the hacky thing.
feelamee · · focus · HN ↗
daveedvdv · · focus · HN ↗
We have two "back ends": c_gen_be.c generates C code from the lower IL ("intermediate language"; EDG's term for the AST) and cp_gen_be.c generates C++ code from the unlowered IL.
rramadass · · focus · HN ↗
daveedvdv · · focus · HN ↗
saagarjha · · focus · HN ↗
compiler-guy · · focus · HN ↗
You can see some discussion here:
<a href="https://forums.developer.nvidia.com/t/nvcc-preprocessing/64939/7" rel="nofollow">https://forums.developer.nvidia.com/t/nvcc-preprocessing/649...
rramadass · · focus · HN ↗
But i could not find Thibaut Lutz's presentation slides linked to in the above discussion. Any idea where i can find it?
I presume the control flow in the above presentation is the same as found in "The CUDA Compilation Trajectory" chapter in the nvcc documentation (cudafe++ is EDG) - <a href="https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#cuda-compilation-trajectory%5B/url%5D" rel="nofollow">https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index...
rramadass · · focus · HN ↗
Do you have any articles/papers/books/etc. you can point us to for understanding this better?
Two usecases i have in mind are;
1) Transforming legacy C++98/C++03 codebases into "modern" C++11/14/17/20/23/26. Is this possible with current edg?
2) Adding verification conditions based on code analysis; both runtime contract asserts and compile time proofs (possible?) so as to convert "normal" C++ code into "somewhat verified" C++ code.
Some resources that Google brought up;
Challenges and Opportunities in C/C++ Source-To-Source Compilation - <a href="https://drops.dagstuhl.de/entities/document/10.4230/OASIcs.PARMA-DITAM.2023.2" rel="nofollow">https://drops.dagstuhl.de/entities/document/10.4230/OASIcs.P...
C++ Insights - See your source code with the eyes of a compiler - <a href="https://github.com/andreasfertig/cppinsights" rel="nofollow">https://github.com/andreasfertig/cppinsights Tool at <a href="https://cppinsights.io/" rel="nofollow">https://cppinsights.io/
rramadass · · focus · HN ↗
ritualdevin · · focus · HN ↗
[dead]
andrewaylett · · focus · HN ↗
We certainly held it in high regard. It was rare that a compiler bug was in their code rather than ours :).
cryptolobster · · focus · HN ↗
ninkendo · · focus · HN ↗
kristianp · · focus · HN ↗
Something like, oh, I don't know - HTML?
robinsonb5 · · focus · HN ↗
I needed the SMBus specification a week or two back, and was greatly amused by the 1990s-looking website which hosts it - still with purple bevelled buttons adorned with Comic Sans text! But it's crawlable, archivable, won't break when some framework or plugin gets automatically upgraded, and will hopefully still be there in another decade.
[1] smbus.org
Almondsetat · · focus · HN ↗
daveedvdv · · focus · HN ↗
I'd say: - A single executable can emulate pretty much all versions of MSVC, GCC, and Clang. (E.g., pass the option --gnu_version=80300 and it emulates GCC 8.3.0, including a large number of bugs/idiosynchrasies.) - An optimized binary is pretty small. - It builds quite quickly. (A complete "from scratch" build on a modern solid workstation will take just a few seconds.) - It has some interesting source-to-source transformation capabilities (via cp_gen_be.c). ...
rramadass · · focus · HN ↗
rurban · · focus · HN ↗
cyberax · · focus · HN ↗
badsectoracula · · focus · HN ↗
Also, since i mentioned Lazarus, if it can compile itself to Free Pascal, i wonder if it'd be useful for adding C++ support to Lazarus itself so that Free Pascal and C/C++ can be mixed in a project to make self-contained executables for desktop applications. It'd most likely need much more work than that just the compilation to make it a first class citizen like Free Pascal itself is for Lazarus/LCL (e.g. things like the object inspector and code tools being able to understand C++ well enough so that refactoring and stuff like doubleclicking on a button in a form automatically declaring and defining the handler and moving the editor cursor to the newly defined handler's code body), but maybe it could be used as a starting point.
coliveira · · focus · HN ↗
badsectoracula · · focus · HN ↗
But it is a PITA to get working for C++ libraries specifically (and you need a C intermediate for FPC to use). Also i couldn't get it to work for Win32, only Linux.
[0] <a href="http://runtimeterror.com/pages/iv/images/8a6ff400ed9b0d424be8da2bf0b1f014.png" rel="nofollow">http://runtimeterror.com/pages/iv/images/8a6ff400ed9b0d424be...
coliveira · · focus · HN ↗
pjmlp · · focus · HN ↗
<a href="https://www.embarcadero.com/products/rad-studio" rel="nofollow">https://www.embarcadero.com/products/rad-studio
pjmlp · · focus · HN ↗
<a href="https://www.embarcadero.com/products/rad-studio" rel="nofollow">https://www.embarcadero.com/products/rad-studio
foul · · focus · HN ↗
plasticeagle · · focus · HN ↗
"Continuity is the point. This is a change of steward, not a change of course."
JFC it's like reading the haphazard ramblings of a lunatic. It's incredibly sad that a project of this importance felt that their site was safe in the hands of the AI slop machine. The site barely makes any sense.
maximilianburke · · focus · HN ↗
I think it's probably irrelevant in this age of Clang a) existing and b) being everywhere but it still feels like the end of an era.
rurban · · focus · HN ↗