3 ms·
Because Neugram is a different language. It is so only in small ways, but they add up when you are in the parser, and especially in the type checker. First is
by crawshaw 9y ago
Because Neugram is a different language. It is so only in small ways, but they add up when you are in the parser, and especially in the type checker.
First is the fact that the top level is statements, not declarations. That would mean heavy modification to the go/parser package to make the inner-function statement parser the top level.
Second is the fact I need to parse incrementally, to implement a REPL. That would not require serious modification to go/parser, but it would to go/types.
Third is I wanted to experiment with new syntax. It was quicker to get to that experimentation by working from scratch rather than adopting go/parser and go/types.
Fourth is there are some fundamental things I would like to do differently, particularly around how comments are handled. I haven't got there yet.
In retrospect, if the new Go parser inside cmd/compile existed when I started this, I probably would have started from there. (It does many of the things I wanted to do to go/parser.) I suspect I still would have ended up with my own type checker though, if for no other reason than incremental type checking.
- ansible 9y agoI've toyed with making some kind of interpreter for Go. Something that integrates well with it, giving access to all the libraries, channels, goroutines and such. Discussing this with an acquaintance, we decided the best scripting language for Go was... Go. It is interesting to see that you've headed in the same general direction, though you've thought things through much further than we did. I'll have to try it out.