vgel

Joined 6 years ago

Karma
1,176
Submissions
272
Member since
Jun 18
my webzone: https://vgel.me
View on Hacker News

Recent submissions

Comment · 1 year ago
It's less calibrated but still useful, yea
Comment · 2 years ago
Reading the transcript of Stalin, Molotov, etc's conversation with Eisenstein was really interesting. Even if you disagree with their analysis and what they're doing, it's clear they know the period very well--it's hard to imagine modern politicians speaking on history like that.
Comment · 2 years ago
Thank you for making it free! I've used it on my blog (https://vgel.me) forever, since back before I ever would've paid for analytics, and it's been rock-solid the whole time. Some of the most "set it and forget it" software I use. I definitely owe you a donation so I'm glad I saw this!
Comment · 2 years ago
Comment · 3 years ago
Oh, interesting--I remember messing around with flags on the stack but was having issues with the WASM analyzer (it doesn't like possible inconsistencies with the number of parameters left on the stack between blocks). I think your solution might get around that, though!
Comment · 3 years ago
Looks like Schism (https://github.com/schism-lang/schism) got part of the way there, but it unfortunately seems to be dead.
Comment · 3 years ago
I think because it's ambiguous with unary plus (a = +b), since C isn't supposed to have significant whitespace in most circumstances.
Comment · 3 years ago
Comment · 3 years ago
Maybe not the language choice, but the codegen of this compiler is terrible because of the single-pass shortcuts (for example, it unconditionally loads the result of all assignment operations back to the stack just in case you want to write `a = b = 1`, even though 99% of the time that load is immediately thrown away.)
Comment · 3 years ago
Well, I set the 500 line budget up front, and that was really as much as I could fit with reasonable formatting. I'll be excited to see your 500 line C compiler supporting all those features once it's done ;-)
Comment · 3 years ago
I actually almost made it a C-- (https://www.cs.tufts.edu/~nr/c--/download/ppdp.pdf) compiler, but IIRC the `goto`s made me go with the regular C subset instead.
Comment · 3 years ago
I think the code is fairly readable! It's formatted with Black (and therefore limited to reasonable line lengths) and well-commented.

IMO, being under X lines of code is part of the readability—10,000 lines of code is hard to approach no matter how readable it otherwise is.

Comment · 3 years ago
Ooh, this is cool! Using WASM let me avoid writing a register allocator (though I probably would have just used the stack if I had targeted x86/ARM since I wasn't going for speed).
Comment · 3 years ago
I'm not sure, haven't looked at the codebases of old compilers in a long time. Definitely a lot of the language is pretty amenable to it, especially if you have unstructured jumps for e.g. the for advancement statement. I had a distinct feeling while writing the compiler every time I added a new feature that "wow, the semantics work exactly how I'd like them to for ease of implementation."

Compare that to, say, Rust, which would be pretty painful to single-pass compile with all the non-local behavior around traits.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton