Hacker News new | past | comments | ask | show | jobs | submit login

Your compiler's source code. That should shake your confidence in the world.



for an easier time, your favorite language interpreter's source code ... interpreters are easier to comprehend than compilers, since you can 'follow along' with the flow of execution in the main interpreter loop just like you're executing a program ... e.g., creating stack frames, allocating heap memory, assigning variables, etc.


Squeak Smalltalk. For Java, if you can get hold of it, the old Acme Webserver. That was very clean code.


Squeak is pretty sweet. I was looking at the Kernel category and the Parser classes. Pretty clean stuff.


This really depends on the language. Ruby's code is (or at least was) quite nice. It is pretty much OO written in plain C.

By contrast Perl makes very heavy use of macros for portability, to an extent that may induce brain lock in many people, and makes your debugger very hard to follow. This is not to say that its use of macros is a bad thing in the end, but it is a definite shock.


Yeah, after hacking with perl for a while, i got interested in how it worked under the hood, and had some trouble following.

Check out the regex compilation module: http://cpansearch.perl.org/src/GBARR/perl5.005_03/regcomp.c

And execution: http://cpansearch.perl.org/src/GBARR/perl5.005_03/regexec.c


Well, anything touched by Ilya Zakharevich is going to be hard to read, even by the standards of the Perl source code. That means that the regular expression engine will be particularly hard to read.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: