An

An ObjC-like compiler for Mac ARM, x86_64(Linux, Win), WASM, & others

Hacker News

An ObjC-like compiler for Mac ARM, x86_64(Linux, Win), WASM, & others

Hi folks, So this is my announcement of a compiler[1] I've been working on for about 6 months now (so yes, to get the obvious out of the way early, this was written with Claude code). The compiler is called 'xc', stands for 'cross-C' or 'extended-C' or whatever you want, really. It's fairly similar to Objective-C in style (without the [] brackets), and in fact the first version of the language was written in ObjC. It works on Mac M-series, Windows, and Linux - and any of these hosts can create binaries for any of {Mac M-series, Windows, Linux, Android, iOS, WASM, Arm9 (Zynq), m68k and even 6502}. Building the compiler needs host-tools to bootstrap everything, either GNUStep on Linux, or a Mac with Xcode. Once built, however, the system is entirely self-contained, and you don't need any platform tools. I have a binary running on my iPhone which was compiled and signed on a Linux box... The suite ships with 5 host-specific assemblers, 10 object/executable writers, and a native Apple code-signer (we don't shell out to 'codesign') Downloads are available at [3] for all three hosts (xcc-osx-0.6.tar.bz2, xcc-linux-0.6.tar.bz2, xcc-win64-0.6.zip). Linux and Windows are larger because of static linking to make sure things are easy to run. The documentation for the language is all at [2], it goes into the language details, but you get ARC (Automatic reference counting, which automatically goes atomic when you have threads), blocks, callbacks, Classes, and Protocols. It's an optimising compiler with a shared IR, deliberately not LLVM's IR because one of the original targets was the 6502, and LLVM likes register-rich architectures. The compiler runs Vectorize, LICM, LoopRotate, LoopUnroll (fixed and variable trip), StrengthReduce, Inline, TailRecursion, NarrowIV, PointerIV, RedundantLoadCSE, IdiomMemset, LoopReductionCollapse,... One major inter-operability feature is the ability to say #import <GEM> (or #use, which also promotes its statics into the bare-call space) and have the compiler read libGEM.so, parse its DWARF, and expose the functions, types and enum constants inside. Xc uses the platform's native structure packing, so binding a C library is mostly just pointing -L at it. The Licence for the compiler is GPL3, for the standard library there's the "standard" library exception, since that code is bundled into most apps. Bottom line, you are free to create any applications you like, open or closed, without any licensing issues. If you make a fix to the compiler, I would appreciate the bug report/patch. A utility in the tools/ section is c2xc. This takes almost all C code (I used it on Kundert's Sparse 1.4 — sparse.sourceforge.net) and converts it to valid XC. It might not be the best XC possible, but it will compile, and if you're trying to produce WASM code and can't just #use a dynamic library, this is the important part :) There's also the beginnings of a cross-platform UI toolkit and Interface-Builder, though these are very early days. There are 568 fixtures, 608 unit-tests, two simulators (6502 and 68k) and ~50 differential scripts to check output vs clang / binutils. The compiler is written in its own language, forming a "reference" ObjC compiler and the "shipped" written-in-xc compiler (all 120k lines of it), meaning it has two chances to find obscure bugs. Other real-world tests have been: - transpiling Kundert's Sparse 1.4 to xc and diffing its test program's output against a clang build of the same library - a circuit simulator built on it, checked against ngspice-47 and against an independent numpy MNA implementation - writing a "test in anger" application, a server that listens for incoming web requests, parses them, uses them to query a DB and then sends the results out to a web-client (written in XC, and compiled to WASM) Enjoy :) 1: https://github.com/ThrudTheBarbarian/xc 2: https://compile-xc.org/ 3: https://compile-xc.org/compiler/downloads

Share card

Actual performance

2points
9comments
Did not reach leaderboard

Launch Intel predictions

Analyze your own launch →
Indie HackersFits the IH revenue-focused audience · Strong signals: ios · Missing: supports, reddit linkedin, podcasting
93%93% predicted probability of success on Indie Hackers, based on ML models trained on real launch data.
best fitHighest predicted score across all platforms for this description.
Product HuntOn track for Day 1 leaderboard · Strong signals: mac, claude, apple · Missing: agents, macos, agent
89%89% predicted probability of success on Product Hunt, based on ML models trained on real launch data.
Hacker NewsStrong engagement from HN community · Strong signals: ide, io · Missing: https docs, excited, just released
57%57% predicted probability of success on Hacker News, based on ML models trained on real launch data.
nativeThis product was originally launched on this platform.
AppSumoStrong fit for a featured deal · Strong signals: platform, host, interface · Missing: plus, intuitive, reviews
57%57% predicted probability of success on AppSumo, based on ML models trained on real launch data.
TrustMRRLess likely to generate early MRR · Strong signals: ios, apps, month · Missing: mobile apps, personal, entrepreneurs
50%50% predicted probability of success on TrustMRR, based on ML models trained on real launch data.
Acquire.comPre-revenue stage for this audience · Strong signals: arr · Missing: mrr, revenue, profit
18%18% predicted probability of success on Acquire.com, based on ML models trained on real launch data.
BetaListMay not resonate with beta-testers · Missing: web3, chat, crypto
0%0% predicted probability of success on BetaList, based on ML models trained on real launch data.

Incorrect prediction on native model

Similar products

KS
KSM Linux/Win X64-Hypervisor (#VE, VMFUNC, Nesting)52%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

KSM Linux/Win X64-Hypervisor (#VE, VMFUNC, Nesting)

Hacker News2
Li
Lima: Linux-on-Mac (“macOS Subsystem for Linux”, “Containerd for Mac”)67%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Lima: Linux-on-Mac (“macOS Subsystem for Linux”, “Containerd for Mac”)

Hacker News2
Va
Variant Symlink Filesystem for Linux85%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Variant Symlink Filesystem for Linux

Hacker News2
Di
Distributed memcached in Linux kernel71%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Distributed memcached in Linux kernel

Hacker News7
Co
Compressed directories on Linux60%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Compressed directories on Linux

Hacker News70
Sq
Sqlite3-X64 – SQLite Precompiled Binaries for Linux X6467%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Sqlite3-X64 – SQLite Precompiled Binaries for Linux X64

Hacker News2
Ex
ExpanDrive for Linux72%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

ExpanDrive for Linux

Hacker News14
An
An Aesthetically Pleasing Arch Linux Distro72%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

An Aesthetically Pleasing Arch Linux Distro

Hacker News76
Co
CoreOS, a Linux distro for containers67%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

CoreOS, a Linux distro for containers

Hacker News417
20
2048.ko: 2048 as a linux kernel module47%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

2048.ko: 2048 as a linux kernel module

Hacker News3