NOW LET US – AI RAG SaaS Studio TP.HCM
NOW LET US
Digital Product Studio
Back to news
DEV-TOOLS...1 min read

C89cc.sh – standalone C89/ELF64 compiler in pure portable shell

Share
NOW LET US Article – C89cc.sh – standalone C89/ELF64 compiler in pure portable shell

c89cc.sh is an ambitious open-source project that compiles C89 code into x86-64 ELF64 binaries using only pure, portable shell script without any external dependencies.

In the world of programming, building a compiler usually requires low-level languages or complex toolchains. However, the c89cc.sh project by Alexandre Gomes Gaigalas breaks conventional rules by implementing a complete C89 compiler using only pure POSIX Shell script.

A Zero-Dependency Compiler

The most impressive aspect of c89cc.sh is its absolute independence. According to the source code, this compiler clears the PATH environment variable, meaning it does not call any external commands from the operating system. Every task—from parsing and string manipulation to binary generation—is handled by internal Shell functions.

The project supports the C89 standard and is capable of outputting ELF64 executables for the x86-64 architecture. This allows developers to compile C source code even on the most minimal systems, as long as a POSIX-compliant Shell interpreter is available.

High Compatibility and Portability

The author designed c89cc.sh to work seamlessly across various Shell environments such as bash, zsh, ksh, and yash. The source code includes compatibility layers to ensure commands like local or printf behave consistently across all platforms.

Key technical features integrated into this single script include:

  • Advanced String Processing: Manually written functions for case conversion, string repetition, and Unicode handling.
  • Detailed Error Management: An error reporting system capable of pinpointing the exact line and column of issues in the C source code.
  • Built-in Standard Library (libc): Users have the option to use the included libc or skip it using the --no-libc flag.

How It Works

Using c89cc.sh is extremely straightforward via the command line. Users simply pipe the C source code into the script and receive an executable file:

sh c89cc.sh < program.c > a.out

While writing a compiler in Shell Script might not offer the performance of GCC or Clang, c89cc.sh serves as a brilliant demonstration of the power of basic command-line tools. It is not only a fascinating engineering project but also a valuable educational resource for those wishing to dive deep into ELF file structures, parser mechanics, and the limits of Shell scripting.

© 2026 Now Let Us. All rights reserved.

Source: Hacker News

Advertisement
Ad slot ready: 5887729102

More in this category

NOW LET US Related – GLM 5.2 Is Out

dev-tools

GLM 5.2 Is Out

Zhipu AI has officially released GLM-5.2, its most powerful open-source model to date, featuring a 1M context window and advanced long-horizon task capabilities. The release underscores Zhipu's commitment to open-source AI and global scientific collaboration amid rising technological restrictions.

NOW LET US Related – Noise infusion banned from statistical products published by Census Bureau

dev-tools

Noise infusion banned from statistical products published by Census Bureau

The U.S. Department of Commerce has banned "noise infusion" from statistical products published by the Census Bureau, a decision that could have severe consequences for both data utility and privacy protection.

NOW LET US Related – Treating pancreatic tumours may have revealed cancer's master switch

dev-tools

Treating pancreatic tumours may have revealed cancer's master switch

A promising new drug called daraxonrasib has shown breakthrough results in treating pancreatic cancer, doubling median survival times. This achievement could pave the way for an entirely new class of cancer treatments.

NOW LET US Related – Every Frame Perfect

dev-tools

Every Frame Perfect

In UI design, perfection isn't just about the start and end states, but every single transition frame in between. Polishing these micro-interactions is key to building user trust.

NOW LET US Related – Leaving Mozilla

dev-tools

Leaving Mozilla

A poignant and candid reflection from a 15-year Mozilla veteran upon their departure. The author highlights the leadership's missteps in trying to emulate tech giants and urges Mozilla to return to its core values: community and uniqueness.

NOW LET US Related – Shepherd's Dog: A Game by the Most Dangerous AI Model

dev-tools

Shepherd's Dog: A Game by the Most Dangerous AI Model

A developer tested Anthropic's latest, supposedly 'too dangerous' AI model by asking it to build a long-held game idea in a single shot. The model succeeded, generating a complete 2,319-line game after a 45-minute reasoning session.

EXPLORE TOPICS

Discover All Categories

Deep dive into the specific technology sectors that matter most to you.