News for hackers. Stuff that matters.
Re:Show HN: Writing my first interpreter in C for fun by stevekemp on Wednesday June 22, 2016 @09:33AM (#11953733)
That's a nice set of readable code. I made a minor change just to add in floats instead of ints, which wasn't too hard to accomplish thanks to your structure.

(Though my changes are ugly).

If/When you get to implementing functions things will get really useful :)

Re:Show HN: Writing my first interpreter in C for fun by jhedwards on Wednesday June 22, 2016 @11:28AM (#11954671)
I just realized reading your comment that I did implement functions but I forgot to document them! I will update the readme immediately.

If you look in the main file, huo.c, you will see something called store_defs. That function takes the ASTs of defined functions and stores them in a key-val type store. If someone invokes a user-defined function I just grab the AST, replace the variables with the values they passed in and execute it. That code is in process_defs and is invoked by execute.

Re:Show HN: Writing my first interpreter in C for fun by stevekemp on Wednesday June 22, 2016 @11:56AM (#11954865)
Wonderful news. I managed to gloss over that :)