ocean

Languages and libraries

c compiler

SHOW HN2021

159points
42comments
#303of 2,533 in 2021
Top 12%of 2021 by points

How HN took it

CuriousMostly questions and neutral comments

2 positive, 10 neutral or asking, 0 mixed, 2 critical, out of 14 comments about the project. Thread score +0.03.

Idea: 0 for, 1 againstExecution: 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

  • Good learning project and great way to learn compilers

    From 2 comments
    • Just a few small suggestions: 1. Some code seems to be duplicated (although with slightly different formatting) across multiple files, like dd/dw/db in elf.c and x86.c for…
      thamer on HN
    • Great job! Writing a compiler from scratch is a massively valuable learning experience. I wrote one in BASIC for the 6502, that became self-hosting on April 24th, 1982. I'm going…
      justinlloyd on HN

Objections

  • Not really a C compiler yet; the function syntax deviates from C

    From 1 comment
    • > Programming language that compiles into a x86 ELF executable. > a compiler somewhat resembling C > Add new or borrow from other language(s) features ontop of C, deviate away…
      MisterTea on HN

Requests

  • Use C-style string handling alternatives such as length-carrying strings

    From 1 comment
    • If you are exploring alternatives to the stdlib, you might commit yourself to no zero terminated strings and see where it takes you. A fundamental data type with a pointer, a…
      jeffrallen on HN

Questions

  • What resources were used to learn compiler construction

    From 1 comment
    • Any specific resources you've used that you could recommend in line with compiler construction?
      kinga254 on HN

Alternatives named

  • Flex and Bison / yacc

    From 2 comments
    • This is just an anecdote, but I had to write a SQL DDL and DML parser during my last semester. I wrote the DDL parser by hand, and it wasn't as bad as I expected, but it was time…
      jjice on HN
    • You could use https://en.wikipedia.org/wiki/Yacc I decided to write my own lexer/parser/compiler it's pretty straightforward. Sources I use(d) to program this, e.g look at…
      r1chardnl on HN
  • ANTLR

    From 2 comments
    • I wrote a C compiler* using flex [1] and bison [2] that generated MIPS code. The biggest downside was the rather complex glue code. At some point ANTLR [3] looked promising, but…
      optymizer on HN
    • I've had good luck with ANTLR4 and ObjWeb ASM for my JVM language Imp https://github.com/mh15/imp
      MH15 on HN
  • Crafting Interpreters

    From 1 comment
    • This is specific to interpreters but the beginning part related to parsing and AST is common: http://craftinginterpreters.com/contents.html
      blcArmadillo 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/28048528)