Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

One advantage to this is the ease with which it handles ephemeral annotations.

Suppose you want to attach additional information to some of the nodes of the AST. Different algorithms on the AST will attach different information; you don't necessarily need them all at the same time or know ahead of time what you'll need.

With nodes, you have to have some sort of node/value hash table, or hang a key/value map off each node. But with this flattened representation, each datum gets its own flat array as well, which can be independently allocated and deallocated.

One other thing I noticed about this flat representation is that it throws static typing into a cocked hat! All you have to refer to other nodes is indices. All different kinds of nodes are stored in the same array.



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

Search: