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

This. 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.



The 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


Is 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?




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

Search: