Hacker Newsnew | past | comments | ask | show | jobs | submit | liamilan's commentslogin

I built Crumb (https://github.com/liam-ilan/crumb) a year ago, before starting university. It completely changed the way I conceptualized programming as a whole. You start feeling deja-vu every time you open a new language, and the "ah-ha!" feeling you get when you see something in another language you had to think about when implementing your own is super rewarding.

A year later (this summer) I used Crumb to land my first job at a pretty cool startup! The payoff was way more than I could have ever expected.


Read Crafting Interpreters when building Crumb (https://github.com/liam-ilan/crumb). It was indispensable, especially the sections on scope and local variables. The balance between technical implementation and conceptual insights is super helpful, especially when trying to go off of the book’s set path.

It’s inspiring to see technical writing done like this. As an aspiring engineer, this sets a really high standard to aim for - excellent resource.


> when building Crumb (https://github.com/liam-ilan/crumb)

> As an aspiring engineer

I’ve got some good news for you.


> Aspiring engineer

You already made it, no need to be humble. You don’t need to finish the CS to call yourself engineer :)

Great documentation and an awesome project. Good job.


This looks cool! How did you decide on what data types to include?


Personal choice, is what I'd say. You can get a lot of mileage out of implementing a dynamic language with NaN boxing[1].

It really depends on the kind of language you're trying to build an interpreter for, and what purpose it could serve. For dynamic languages, I'd say looking at the core types of Erlang is a great place to start (Integers, Symbols, Functions, etc.). For a statically typed language things get more complex, but even with just numeric types, characters, and some kind of aggregating type like a Struct you can build up more complex data structures in your language itself.

[1]: https://leonardschuetz.ch/blog/nan-boxing/


Really neat article, this is my first encounter with the concept of NaN Boxing. Thanks for sharing!


It was my first time making a language, so I built into the language whatever was needed to build something cool with Crumb.

Wanted first class functions to simplify the parse step (they can be treated like any other value), but I needed a different mechanism to invoke “native code” vs user-defined methods, so there’s two different types for that.

Needed some kind of compound data type, but I didn’t want to deal with side effects from pass by reference, so Crumb implements lists, but they are always pass by value :)

P.s. theres some pretty neat stuff build with Crumb at https://github.com/topics/crumb if anyone’s interested!


  Location: Vancouver, BC
  Remote: Yes, can work onsite/hybrid as well
  Willing to relocate: Yes
  Technologies: JavaScript, Node.js, Express, Python, Poetry, Flask, Git, Java, C, C++
  Résumé/CV: https://drive.google.com/file/d/1rxE6SmDzM02jQikSbBFKIH1-ptAQ8rV6/view?usp=sharing
  Email: liamilanyvr@gmail.com
Hi! I'm Liam, a freshman at UBC, aiming to specialize in Computer Science/Physics. Looking for a software related internship in the summer. I've been programming for 7 years, and built dozens of projects, most of them can be found on my Github (https://github.com/liam-ilan).

Over the summer, I built Crumb (https://github.com/liam-ilan/crumb), a programming language from scratch, which was front paged here a couple months ago! I'm also a member of the firmware team at UBC Formula Electric, working on porting firmware for the Front Sensor Module to our next car.

Open to doing just around anything you need me to do. If you have an opening, or any advice, hit me up :D



Just a friendly UBC piggyback on Waterloo’s programming language ;)

Over summer, I built my own little functional language, Crumb (https://github.com/liam-ilan/crumb). Unlike Flix, the scope is tiny, but some pretty awesome stuff has been done with it. (Checkout this pixel art editor in your terminal, 100% Crumb: https://github.com/ronilan/crumbicon).

There’s a template (https://github.com/liam-ilan/crumb-template) and vscode highlighter (https://github.com/liam-ilan/crumb-vscode) for anyone who wants to mess around with it. Any feedback super appreciated :D


Robert Nystrom's Crafting Interpreters (https://craftinginterpreters.com/) is an awesome resource :D

Though I didn't implement his language exactly, a lot of what he talks about carries over anywhere. It especially helped me figure out how to handle the memory management and scoping.

Vincent Jacques' DrawGrammar (https://jacquev6.github.io/DrawGrammar/) was also super helpful. Getting to see the syntax definition visually made writing it so much easier :).


Thanks!


Yeah actually, stay tuned! :D


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 returned out of a statement, or assigned to a variable, said value is freed.

3) When a function is applied, if an argument has no reference (it is not stored in a variable), it is freed.

4) Additionally, if the function itself has no reference (such as in the case of an immediately invoked function), it is freed.

Hope that clarifies things a bit :D


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)
     <- y
  }
How does the compiler decides if it must free the memory used by x?


All lists are passed by value and X isn't the return value, would be my guess


It's an interpreter rather than a compiler, and looking at the code it seems to use ref counting


Ref counting makes a lot of sense with the description of the OP, and if there are no cycles it's good.


It should. Everything is copied and by-value, there are no references/pointers or even closures, cycles are impossible. Think Pascal that has garbage collection for strings and dynamic arrays.


  Location: Vancouver, BC
  Remote: Yes
  Willing to relocate: No
  Technologies: JavaScript, Node.js, Express, Python, Poetry, Flask, Git, Java, Matplotlib and more
  Résumé/CV: https://drive.google.com/file/d/14oXe10o0N2EJdYOyCrMbV56WDVK_U3Ac/view?usp=sharing
  Email: liamilanyvr@gmail.com
Hi! I'm Liam, just graduated from high school, going into UBC Sciences next year, and looking for a programming related internship/mentorship/job. I'm a snowboard instructor during the winter season, so I have some work experience. I've been programming for 7 years, but have never worked professionally in the field, mostly working on personal projects.

My most recent project is a database of electron orbital probability distribution renders done in Python and Matplotlib: https://liam-ilan.github.io/electron-orbitals/

Check out my GitHub: https://github.com/liam-ilan

Open to doing just around anything you need me to do. If you have an opening, or any advice, hit me up :D


  Location: Vancouver, BC
  Remote: Yes
  Willing to relocate: No
  Technologies: JavaScript, Node.js, Express, Python, Poetry, Flask, Git, Java, and more
  Résumé/CV: https://drive.google.com/file/d/14oXe10o0N2EJdYOyCrMbV56WDVK_U3Ac/view?usp=sharing
  Email: liamilanyvr@gmail.com
Hi! I'm Liam, 16, and looking for a programming related internship/mentorship/job. I'm a snowboard instructor during the winter season, so I have some work experience. I've been programming for 6 years, but have never worked professionally in the field, mostly working on personal projects. You can find some of them at https://www.liamilan.com/ Open to doing just around anything you need me to do. If you have an opening, or any advice, hit me up :D


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

Search: