Earlier quoted context omitted.
That old chestnut. C is nothing remotely like an assembly language, of any kind. It is a low-level programming language, but only compared to most languages. Disassemble some compiled C code sometime -- it's another world entirely.
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.
Show HN: Going into freshman year, figured I should build an interpreter
41–50 of 84 posts
Re: Show HN: Going into freshman year, figured I should build an interpreter
#42Here'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
#43Here'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
#44[flagged]
OP is at a stage in life where fluid intelligence is still very high and crystallized intelligence is growing rapidly. This is the time in your life where you are perhaps most able to absorb new ideas and ways of thinking, before you get set in your ways and less receptive to different ways of thinking.
Re: Show HN: Going into freshman year, figured I should build an interpreter
#45You may start with reversing compiled-code, but interpreter is much-much more.. interesting. Especialy if of unknown (simple) language.
Re: Show HN: Going into freshman year, figured I should build an interpreter
#46Earlier quoted context omitted.
Ya, but would you rather spend the summer enjoying summer or writing C
It depends. When I was young I could spend hours coding and it felt amazing and like a great use of my time. Now in my 30s? No way, writing detailed code and spending all my time in front of the screen feels like I’m throwing away my life. All that minutia, whether useful or useless, is repulsive.
I came to realise I don't even like "real" programming only random quickly put together scripts.
When my friends explored all kind of things I was so stuck on coding and web dev and php. I didn't check out any other fields of interest or professions. When I read all the threads here about parents teaching their 4 year old BASIC to "indoctrinate them into programming", I cringe hard. They're stealing their kids' childhood and their drive to explore what they'd actually love.
Re: Show HN: Going into freshman year, figured I should build an interpreter
#47[flagged]
If that's the case at the Uni OP is studying at, then he should be come fluent in C - because from experience as a TA, it's not necessarily the CS knowledge/fundamentals that tend to be lacking when people struggle with classes, but rather that they're fighting a new language. Even if they have years of previous experience...especially in these days, when Python or JS tend to be the first (and only) language to many freshmen.
Re: Show HN: Going into freshman year, figured I should build an interpreter
#48That'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 badly, but in a predictable way. In C and C++ it may behave reasonably, it may crash in another file altogether few seconds after the erroneous line is executed, it may produce the correct answer. Or it may crash only sometimes. Or it may silently produce an incorrect answer. Different behaviors on different systems, and even on the same system with different compiler flags (e.g. optimization level), of course.
That makes reliable experiments with C and C++ impossible. Even if you have just five lines of code, you almost never know if they're valid C or C++ for sure (separately, whether they do what you want with modern/legacy compilers). It's still fun and everything (congrats on making your own language, that should've been fun!), but you never truly know whether what you wrote is not going to break in a few years (or months) with zero code modifications just because there was another UB lurking around.
See https://evan.nemerson.com/2021/05/04/portability-is-reliabil... if you're curious about more practical implications.
Re: Show HN: Going into freshman year, figured I should build an interpreter
#49Earlier 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
#50My 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…