30cc

Languages and libraries

c compiler

SHOW HN2024

275points
128comments
#243of 3,515 in 2024
Top 7%of 2024 by points

How HN took it

LovedMost comments that take a side are positive

11 positive, 9 neutral or asking, 1 mixed, 1 critical, out of 22 comments about the project. Thread score +0.47.

Execution: 2 for, 0 againstDesign: 1 for, 0 againstIdea: 0 for, 1 against

The thread, comment by comment

Each row is a top-level comment and its replies, in HN's order. Select a cell to open that comment on HN.

positive neutral or mixed critical about another commenter or something else the maker

What HN said

What people liked

  • Congratulations and impressive achievement

    From 4 comments
    • > Then run ./build.py. This will use the bootstrapped 30cc-compiler to compile 30cc itself. It then again uses the 30cc-compiled compiler to compile 30cc once again. The final…
      yjftsjthsd-h on HN
    • Congratulations!
      jesse__ on HN
    • Congratulations! That's no small feat.
      anyfoo on HN
    • Congrats!!
      rangerelf on HN
  • Interesting bootstrapping project

    From 2 comments
    • Sounds like you might be someone interested in the Bootstrappable Builds project: https://bootstrappable.org/ https://lwn.net/Articles/983340/
      pabs3 on HN
    • What a fun project, thanks for sharing. I've dreamed of projects like this. What did you expect to learn from this project? Did you learn anything unexpected?
      michael-online on HN

Objections

  • Supports only about 70% of C; no floating-point or arrays

    From 1 comment
    • i think it just supports smth like 70% of C. I didn't bother supporting floating-point operators, or arrays (I mean, malloc and pointers are fine) or etc. I just wanted smth…
      keyvank on HN
  • Cannot compile some syntax like void* casts without type errors

    From 1 comment
    • thanks man! yes that makes sense. unfortunately 30cc is not able to compile that syntax, and will probably give type-checker errors when passing a void* to pointer of another…
      keyvank on HN

Requests

  • Use Makefile instead of Python build script

    From 1 comment
    • > Then run ./build.py. This will use the bootstrapped 30cc-compiler to compile 30cc itself. It then again uses the 30cc-compiled compiler to compile 30cc once again. The final…
      yjftsjthsd-h on HN
  • Explain why three compilation steps

    From 1 comment
    • Nice job! But why 3 steps of compilation? The first step merely shows that you wrote valid C code that gcc can compile. It doesn't prove that the program actually does what…
      teo_zero on HN

Questions

  • Were you constrained in C usage to allow self-compilation?

    From 1 comment
    • > Then run ./build.py. This will use the bootstrapped 30cc-compiler to compile 30cc itself. It then again uses the 30cc-compiled compiler to compile 30cc once again. The final…
      yjftsjthsd-h on HN
  • Would the two compiled binaries be identical?

    From 1 comment
    • Out of curiosity: would ./30cc_gcc (30cc complied by gcc-hosted 30cc) and ./30cc (30cc complied by self-hosted 30cc) be identical binary files, if 30cc was operating as expected?
      mizzao on HN

Alternatives named

  • Small-C compiler by James E Hendrix

    From 1 comment
    • Similar: "A Small-C Compiler", by James E Hendrix (not Jim E, not Jimi). Modify source, compile self, repeat. This repo claims to have the code: https://github.com/DosWorld/smallc
      euroderf on HN
  • cp2 compiler-compiler

    From 1 comment
    • nice work. if you want more of a challenge try a compiler compiler that can compile itself... :) i got pretty far with this myself, although it doesn't work for weirdo languages…
      jheriko on HN

Category, keywords, summaries and labels on this page were made by AI (Thread Reader v2) and not checked by hand. Each point links to the comments it came from.

Add a badge to your READMEShown on HackerShow
[![Shown on HackerShow](https://hackershow.org/badge.svg)](https://hackershow.org/show/42311031)