News for hackers. Stuff that matters.
Re:Writing a C compiler in 500 lines of Python by zabzonk on Monday September 04, 2023 @04:07PM (#37384445)
using recursive descent, you don't need to build an ast
Re:Writing a C compiler in 500 lines of Python by jjtheblunt on Monday September 04, 2023 @04:25PM (#37384640)
the call stack during recursive descent is an ephemeral ast, for the recursive descent parsers I've written.
Re:Writing a C compiler in 500 lines of Python by hedora on Monday September 04, 2023 @07:08PM (#37386061)
That implies the memory usage is proportional to the depth of the AST, not the total size (which is the point, I think).
Re:Writing a C compiler in 500 lines of Python by pjmlp on Tuesday September 05, 2023 @02:17AM (#37388461)
Only if the compiler doesn't do anything beyond basic peephole optimizations.