←back to thread

517 points petercooper | 2 comments | | HN request time: 1.293s | source
Show context
marcofiset ◴[] No.8558994[source]
I honestly think this is ridiculous. Sure, this is an incredible feat, and congrats. But serioulsy, I would be ashamed to publish such unreadable code under my name.

What about naming your variables with descriptive names?

What about extracting complex conditions into well named function to understand what is going on (thus defeating the purpose of the "4 functions") ?

This list could go on forever...

Writing software is not a contest for who can write the most amount of code in the most cryptic way.

replies(12): >>8558999 #>>8559001 #>>8559009 #>>8559056 #>>8559071 #>>8559139 #>>8559196 #>>8559249 #>>8559421 #>>8560270 #>>8560608 #>>8561021 #
1. more_original ◴[] No.8559196[source]
> I honestly think this is ridiculous. Sure, this is an incredible feat, and congrats.

It's not that bad (or difficult), really. It's a hand-written parser for a subset of C that emits assembly code right away. This is how compilers like Turbo Pascal used to work (see http://www.pcengines.ch/tp3.htm for an explanation of what's happening).

Sure, you could apply cosmetic changes like making "*++e = bla;" into "emit(bla);" and you could move the cases into independent methods (that are used once), but this isn't meant to be a state-of-the art compiler and it won't become one if one applies best practices to it.

replies(1): >>8559773 #
2. sehugg ◴[] No.8559773[source]
I don't think it supports forward references either, which also makes it more like Pascal.