4 ms·
Arena allocation is very trivial in zig
by Cloudef 2y ago
Arena allocation is very trivial in zig
- himujjal 2y agoThis. Writing a parser in Zig is so simple. Just allocate once, and then start writing your parser. One allocator for parser, one for scanner. One for type allocation. Keep them all for semantic analysis. Write the output renderer (binary/language). Deallocate. In this whole process, it makes it so easy to not think about memory anymore. Just enjoy writing your program.
- JonChesterfield 2y agoThe scanner can probably be zero allocation though - zig should be able to express an iterator over the input byte array that returns a token on dereference without needing more state than the position in the array
- lylejantzi3rd 2y agoIs there a detailed blog post or a book or something you can share that shows how easy it is to write a parser in zig?