-
Notifications
You must be signed in to change notification settings - Fork 227
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
Pre-parsed stdlib #100
Comments
I tried to dump ast using go-spew (https://github.com/davecgh/go-spew), it's practicable: about 7w line source code is generated. The problem is: we need fork go-spew and modify its source code to make the generated files meet go's syntax. |
My feeling is that the easiest and most maintainable way would be to do it by hand (without go-spew), i.e. have a function that does a type switch over ast nodes and formats each of them into a go source code representation. There are just ~30 AST node types IIRC. This will give us full control over the output and let us specially handle location information, aliased nodes and other complex cases. I think that with some helper functions the boilerplate could be minimal. |
utter(github.com/kortschak/utter) works. See experiment: #101 The only problem is: we need make ALL fields of AST node as public, then the dumped source code can be put in any package. Otherwise, we must put the source code in the "ast" package. |
#82 will also benefit from this. |
@mqliang wrote in #89:
I think we should look into it. It sound quite easy.
The text was updated successfully, but these errors were encountered: