3 ms·
What's so hellish about the Lua codebase? I've found it extremely understandable and hackable. The parser is a recursive descent, syntax-directed translator t
by groovy2shoes 12y ago
What's so hellish about the Lua codebase? I've found it extremely understandable and hackable. The parser is a recursive descent, syntax-directed translator to bytecode. Adding new operators amounts to adding extra token checks to the expression parsing section of the code and generating the appropriate bytecode. The VM itself is even simpler, and adding a new 'type' is just a matter of adding the extra case to the Value union, a new discriminator for the tag, and a handful of extra functions for dealing with it.
Sure it's a little complicated, but language implementation is a complicated topic. It's hard for me to imagine Lua's code being much simpler than it is.
Not sure what Lua's internals have to do with PHP, though.