Get the latest tech news

The life and times of an Abstract Syntax Tree


By Francesco Bertolaccini You’ve reached computer programming nirvana. Your journey has led you down many paths, including believing that God wrote the universe in LISP, but now the truth is …

I’m a C++ troglodyte, meaning I like keeping my footguns cocked and loaded at all times: since there is no garbage collector around to clean up after the mess I leave behind, I need to think deeply about who owns each and every one of those nodes. In fact, go watch this talk about the design of the Carbon compiler, about 37 minutes in: if you keep your pattern of creating nodes predictable, you end up with a storage container that’s already sorted in, e.g., post-visit order! I also feel obligated to mention two maxims one should keep in mind when playing this sort of game: premature optimization is the root of all evil, and always profile your code —it’s likely that your codebase contains lower-hanging fruit you can pick before deciding to fine-tune your AST storage.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Life

Life

Photo of Times

Times

Photo of Abstract Syntax Tree

Abstract Syntax Tree

Related news:

News photo

Google says its secure entry passkeys have been used a billion times

News photo

Presence of gas on exoplanet 'only produced by life'

News photo

Oracle Fusion rollout costs 15 times council's estimates in SAP rip-'n-replace