Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proper Go Parser #107

Open
eapache opened this issue Jan 6, 2015 · 2 comments
Open

Proper Go Parser #107

eapache opened this issue Jan 6, 2015 · 2 comments
Milestone

Comments

@eapache
Copy link
Owner

eapache commented Jan 6, 2015

This has been floating at the back of my mind for a while, but it really wouldn't be too difficult to hand-write a proper lexer/parser for Go since the syntax is so uniform and simple (possibly eventually as a separate gem).

This would permit proper parsing of all the weird corner cases that the current version breaks on, and much better recognition of variable uses, etc. Go provides a very nice spec with a full formal grammar etc (https://golang.org/ref/spec) so the information is available, I just need to bother to write it.

@eapache eapache added this to the Backlog milestone Jan 6, 2015
@arup42
Copy link

arup42 commented Dec 9, 2015

I don't have a clear understanding of what starscope requires, but doesn't go already provide most of what you'd need, well beyond just the spec. See, for example:
https://golang.org/pkg/go/ast/#example_Inspect

Is the problem that code for starscope would have to be in ruby?

@eapache
Copy link
Owner Author

eapache commented Dec 9, 2015

code for starscope would have to be in ruby?

Yes. I've thought about writing a small tool in Go and then having starscope spawn it to get the AST, but on many files that would probably be too slow, since spawning processes is expensive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants