3 ms·
Great writeup! And actually a fun idea for an intro to rust compiler internals. I'll be stepping through this in detail later. It would be extra cool if you ha
by drvdevd 10y ago
Great writeup! And actually a fun idea for an intro to rust compiler internals. I'll be stepping through this in detail later.
It would be extra cool if you had a series and did this with Go as well :)
- Manishearth 10y agoThanks! It shouldn't be hard, and I've played with the Go AST before. I ... could :) This was sort of a bucket list thing though, doing it a second time is less fun :p And I don't have that much time. Why don't you try? The technique explained in the blog post is pretty universal. Go has an AST too, and while the Folder abstraction doesn't exist in its codebase (as far as I know), you can still tweak the AST. In the case of Go it would be easier to do the injection during parsing. https://github.com/golang/go/blob/5c9035acc1e1540a564ea660000f4f64e783d5ac/src/go/parser/parser.go#L2369 https://github.com/golang/go/blob/5c9035acc1e1540a564ea66000... would be a good entry point. https://golang.org/pkg/go/ast/ https://golang.org/pkg/go/ast/ should help. (I am not a Go compiler dev so there may be better entry points)
- kibwen 10y ago> It shouldn't be hard, and I've played with the Go AST > before. I ... could :) Do it! :) Sadly the title is destined to be less fabulous than this one, but given Thompson's association with Go the motivating angle is obvious.
- drvdevd 10y agoAh yes - I forgot to mention: great title!
- drvdevd 10y agoI think I might as well :) Time is also an issue for me though, but it's not a complete impossibility. I appreciate the tips on starting points. Very interesting. If I do end up doing something like this I will give credit where it's due.