Hacker News with Generative AI: Compilers

COBOL front-end added to GCC (gcc.gnu.org)
This page is a "brief" summary of some of the huge number of improvements in GCC 15.
Driving Compilers (2023) (fabiensanglard.net)
This series is divided into five parts. First is explained the component which rules them all, the compiler driver (1). Then we drill into the three stages of the compilation pipeline, detailing their inputs/outputs. The pre-processor (2), cpp, converts source code files into translation units (TU), is covered first. Then comes the compiler cc (3), which ingests TUs and outputs relocatable (object) files. Then we look at the element combining all objects together into and executable, the linker ld (4).
GCC 15 is now available, with support for more draft C++26 features (isocpp.org)
GCC 15 is now available!
C++26: more constexpr in the standard library (sandordargo.com)
Last week, we discussed language features that are becoming constexpr in C++26. Today, let’s turn our attention to the standard library features that will soon be usable at compile time. One topic is missing: exceptions. As they need both core language and library changes, I thought they deserved their own post.
GCC 15.1 (gcc.gnu.org)
The GCC developers are pleased to announce the release of GCC 15.1.
Some __nonstring__ Turbulence (lwn.net)
New compiler releases often bring with them new warnings; those warnings are usually welcome, since they help developers find problems before they turn into nasty bugs. Adapting to new warnings can also create disruption in the development process, though, especially when an important developer upgrades to a new compiler at an unfortunate time. This is just the scenario that played out with the 6.15-rc3 kernel release and the implementation of -Wunterminated-string-initialization in GCC 15.
C++26: more constexpr in the core language (sandordargo.com)
Since constexpr was added to the language in C++11, its scope has been gradually expanded. In the beginning, we couldn’t even use if, else or loops, which were changed in C++14. C++17 added support for constexpr lambdas. C++20 added the ability to use allocation and use std::vector and std::string in constant expressions. In this article, let’s see how constexpr evolves with C++26. To be more punctual, let’s see what language features become more constexpr-friendly.
Link-Time Optimization of Dynamic Casts in C++ Programs [pdf] (ist.utl.pt)
Pydrofoil: Accelerating Sail-based instruction set simulators (arxiv.org)
We present Pydrofoil, a multi-stage compiler that generates instruction set simulators (ISSs) from processor instruction set architectures (ISAs) expressed in the high-level, verification-oriented ISA specification language Sail.
Things Zig comptime won't do (matklad.github.io)
Zig’s comptime feature is most famous for what it can do: generics!, conditional compilation!, subtyping!, serialization!, ORM! That’s fascinating, but, to be fair, there’s a bunch of languages with quite powerful compile time evaluation capabilities that can do equivalent things. What I find more interesting is that Zig comptime is actually quite restrictive, by design, and won’t do many things! It manages to be very expressive despite being pretty limited. Let’s see!
Bootstrapping Rustc from Source (github.com/dtolnay)
This repo contains a minimal reliable setup for compiling the most recent stable Rust compiler from source on Linux i.e. without downloading any already compiled Rust binaries from the internet.
Things Zig Comptime Won't Do (matklad.github.io)
Zig’s comptime feature is most famous for what it can do: generics!, conditional compilation!, subtyping!, serialization!, ORM! That’s fascinating, but, to be fair, there’s a bunch of languages with quite powerful compile time evaluation capabilities that can do equivalent things. What I find more interesting is that Zig comptime is actually quite restrictive, by design, and won’t do many things! It manages to be very expressive despite being pretty limited. Let’s see!
Ask HN: Writing an Interpreter in Go or Crafting Interpreters? (ycombinator.com)
I'm thinking of learning about compilers and am pleased to find that there seems to be at least two very accessible choices, "Writing An Interpreter In Go" and Crafting Interpreters. Curious if folks here have experience with either and could provide recommendations?
What the hell is a target triple? (mcyoung.xyz)
Cross-compiling is taking a computer program and compiling it for a machine that isn’t the one hosting the compilation. Although historically compilers would only compile for the host machine, this is considered an anachronism: all serious native compilers are now cross-compilers.
Awe – Modern compiler for Algol W (github.com/glynawe)
Awe is a new compiler for the ALGOL W language.
A compiler for the Micron programming language – the Oberon with the power of C (github.com/rochus-keller)
This project implements a compiler for the Micron programming language.
Vishap Oberon Compiler (github.com/vishapoberon)
Ѵishap Oberon is a free and open source (GPLv3) implementation of the Oberon-2 language and libraries for use on conventional operating systems such as Linux, BSD, Android, Mac and Windows.
Apple M1 / M2 / M3 Core Support Might Soon Be Merged for the GCC Compiler (phoronix.com)
When it comes to compiler support for Apple Silicon and their hardware at large, Apple has long been focused on the LLVM/Clang toolchain given their long history with it, employing many of the developers, and Xcode being based on LLVM.
Compilers: Incrementally and Extensibly (2024) (okmij.org)
Compilers is a practical course. Its goal is to build a real compiler, which compiles a high-level language down to the actual x86-64 machine code and produces an executable that runs on student's laptops.
V8: From CFG to Sea of Nodes and back again (v8.dev)
V8’s end-tier optimizing compiler, Turbofan, is famously one of the few large-scale production compilers to use Sea of Nodes (SoN). However, since almost 3 years ago, we’ve started to get rid of Sea of Nodes and fall back to a more traditional Control-Flow Graph (CFG) Intermediate Representation (IR), which we named Turboshaft.
Compiler Options Hardening Guide for C and C++ (openssf.org)
This document is a guide for compiler and linker options that contribute to delivering reliable and secure code using native (or cross) toolchains for C and C++.
A simple, possibly correct, LR parser for C11 (archives-ouvertes.fr)
Tail Call Recursion in Java with ASM (2023) (unlinkedlist.org)
One kind of optimization offered by some compilers is tail call optimization. This optimization does not bring much, since the programmer can always tailor his code without recursion, especially in an imperative language. On the other side, recursive code often times more elegant, so why we don’t let the compiler do the nasty stuff when it is possible? In this article I will present a neat way to implement tail call optimization in Java using byte code manipulation with ASM.
LLVM Back End for MoonBit (moonbitlang.com)
In the past two years, MoonBit has demonstrated significant performance advantages across WebAssembly, JavaScript, and native backends. We believe that for a new language to be truly valuable, it must offer a generational leap in both core performance and developer experience. Today, we are excited to introduce MoonBit LLVM backend support with 8× the performance of Java in the FFT benchmark, and out-of-the-box debugging.
Building Node.js on Windows with Clang-cl (joyeecheung.github.io)
Recently Node.js started to support building with clang-cl on Windows.
What it takes to add a new back end to Futhark (futhark-lang.org)
Recently Scott Pakin suggested writing a blog post on how to add a new backend to the Futhark compiler, and since there’s active fiddling with the backends at this very moment, this is not a bad idea.
C++26 Expansion Tricks (pydong.org)
P1306 gives us compile time repetition of a statement for each element of a range - what if we instead want the elements as a pack without introducing a new function scope?
C++26 Expansion Tricks (pydong.org)
P1306 gives us compile time repetition of a statement for each element of a range - what if we instead want the elements as a pack without introducing a new function scope?
Another Round of Rust Compiler Improvements Merged for GCC 15.1 (phoronix.com)
Relocation Generation in Assemblers (maskray.me)
This post explores how GNU Assembler and LLVM integrated assembler generate relocations, an important step to generate a relocatable file.