3 ms·
The last time I checked, tcc lacked even a simple AST. This led to some pretty weird emitted code (such as swapping parameters on the stack.) Implementing an
by rswier 11y ago
The last time I checked, tcc lacked even a simple AST. This led to some pretty weird emitted code (such as swapping parameters on the stack.) Implementing an AST is not hard, just push and pop nodes on a stack. It also makes a nice front-end/back-end interface.
- andrewchambers 11y agoEliminating memory allocations made tcc extremely fast, They use a value stack rather than an AST. I just think an AST is a bit easier to follow because it means the parser has less code generation logic embedded in it.
- rswier 11y agoNo malloc/free necessary. Just pile up nodes on a stack, then "deallocate" to any saved position.