Nicely done. You're a freshman, picked up C over the summer, and have already built an interpreter for a language that you haven't officially been taught yet, and have a blog with a couple dozen posts. I'll be honest, people with achievements like yours make me feel pretty worthless.
Ya, but would you rather spend the summer enjoying summer or writing C
Show HN: Going into freshman year, figured I should build an interpreter
51–60 of 84 posts
Re: Show HN: Going into freshman year, figured I should build an interpreter
#52Earlier quoted context omitted.
Crumb is garbage collected (there is no need to manually allocated/deallocate memory)... though there is no background "garbage collector" process running... The interpreter for Crumb is a tree-walk interpreter, and it just frees memory whenever it can... Crumb frees memory in the following cases: 1) When a function is finished, all memory related to the scope of that runtime is freed. 2) When an value is not returne…
Sorry if I got the syntax wrong, but in something like f = { x = (list 1 2 3) y = (list x x) z = (get x 1) How does the compiler decides if it must free the memory used by x?
Re: Show HN: Going into freshman year, figured I should build an interpreter
#53My main advice: never trust C, C++, or their compilers. Undefined behavior bites. Even if you just care about the latest 64-bit Ubuntu Linux LTS, compiler updates or flag changes bite as well. That's the main difference between C and C++ and almost any other language. Not the syntax, neither the perceived "low-levelness", nor manual memory management. In any other language, if you make a mistake, the program behaves…
I suppose this is one of those things where people’s experiences vary widely, but FWIW after 20 years of writing C/C++, I can count the number of times this has bitten me on one finger. And even then, I still think it was more likely just an optimizer bug in the god-awful compiler.
E.g. if you work with a single compiler on a single platform all the time and expect the compiler to "just compile the code", then you're likely to learn all its quirks, avoid them automatically, use proper abstractions/contracts/invariants to guard against incorrect code, etc. Moreover, you likely know how exactly the most popular UB shows itself with your compiler.
If you juggle compilers all the time and work with not-so-high-quality code (legacy or not), especially the one with little tests, I expect UB to pop up a lot. Or even if you just test on one platform and do final runs on another, that happens all the time in competitive programming or home assignment grading, especially with beginners.
Re: Show HN: Going into freshman year, figured I should build an interpreter
#54[flagged]
This is bad advice. > several better options these days Every other option requires you to buy into some additional paradigm-of-the-day. You can easily lose decades going down the wrong programming rabbit holes.
> You can easily lose decades going down the wrong programming rabbit holes
total rubbish.
Re: Show HN: Going into freshman year, figured I should build an interpreter
#55Earlier quoted context omitted.
I’ve programmed in both assembly and C, among other things. I stand by it, C is much closer to the machine than most languages.
I think Lisp won that battle. The core syntax was named after actual cpu registers (cdr/car).
Is lambda calculus or the PDP instructions set a closer match to which language?
Re: Show HN: Going into freshman year, figured I should build an interpreter
#56Here's perhaps some unexpected and unsolicited advice... so pretty clearly you aren't going to have a hard time with the CS curriculum (assuming that's what you intend to study) so my $0.02 is - find a second or even third major to augment your skill set. If you are already able to get to this level on your own, you'll likely breeze right through a typical undergrad CS course of study. So consider other courses of st…
you should be studying: lisp ocaml haskell, interpreters (SICP), compilers, type systems, transaction processing, effect systems, FRP, concurrency NOT java guis python SQL databases webdev gamedev .. whatever
Re: Show HN: Going into freshman year, figured I should build an interpreter
#57Here's perhaps some unexpected and unsolicited advice... so pretty clearly you aren't going to have a hard time with the CS curriculum (assuming that's what you intend to study) so my $0.02 is - find a second or even third major to augment your skill set. If you are already able to get to this level on your own, you'll likely breeze right through a typical undergrad CS course of study. So consider other courses of st…
At least that was my experience as a self-thought programmer. The first weeks were super boring for me but also lulled me into being complacent until I suddenly found myself in deep trouble. Just because you understand the practical side does not mean you can will automatically grok the academic side of things.
Re: Show HN: Going into freshman year, figured I should build an interpreter
#58Re: Show HN: Going into freshman year, figured I should build an interpreter
#59Here's perhaps some unexpected and unsolicited advice... so pretty clearly you aren't going to have a hard time with the CS curriculum (assuming that's what you intend to study) so my $0.02 is - find a second or even third major to augment your skill set. If you are already able to get to this level on your own, you'll likely breeze right through a typical undergrad CS course of study. So consider other courses of st…
Re: Show HN: Going into freshman year, figured I should build an interpreter
#60Here's perhaps some unexpected and unsolicited advice... so pretty clearly you aren't going to have a hard time with the CS curriculum (assuming that's what you intend to study) so my $0.02 is - find a second or even third major to augment your skill set. If you are already able to get to this level on your own, you'll likely breeze right through a typical undergrad CS course of study. So consider other courses of st…
I don't know the specific curriculum but I would caution that being a competent programmer does not directly translate into academic success. Yes, the author will have a massive head start but but that does not necessarily mean they will find studying easy. At least that was my experience as a self-thought programmer. The first weeks were super boring for me but also lulled me into being complacent until I suddenly f…