I Wrote A String Type

from blog mcyoung, | ↗ original
↗ original
I write compilers for fun. I can’t help it. Consequently, I also write a lot of parsers. In systems programming, it’s usually a good idea to try to share memory rather than reuse it, so as such my AST types tend to look like this. pub enum Expr'src> { Int(u32) Ident(&'src str), // ... }Rust Whenever we parse an identifier, rather than copy its...