3 ms·
i love how complete golang tooling is. go/analyzer framework is quite advanced and I don't know of other languages that offer accessible AST support .
by tonymet 1y ago
i love how complete golang tooling is. go/analyzer framework is quite advanced and I don't know of other languages that offer accessible AST support .
- whartung 1y agoJDK, I believe, has first class support for accessing the Java AST.
- cryptos 1y agoThere are some internal compiler APIs (so, not officially supported) and some external tools to do so.
- foresto 1y agoDoes this count? https://docs.python.org/3/library/ast.html https://docs.python.org/3/library/ast.html
- tonymet 1y agonot really. that's just an API. i mean all of the tooling and how commonly the API is put to use
- Zambyte 1y agoGo is one of the last languages I'd think about when considering access to the AST. The first would be Lisp.
- tonymet 1y agothere are tons of utilities. and the fact that i've written some means it's pretty easy
- Zambyte 1y agoRight, I'm not saying it's impossible in Go, but it's so easy in Lisp you're bound to do it even by accident. There are no "AST utilities" in Lisp because the AST is just a normal list / tree of primitive values (of the `symbol` type). You operate on code structures with the same libraries that you operate on a list / tree of numbers, strings, etc. Code is data.
- trenchpilgrim 1y agoLisp and Lua both have good AST support.
- gsck 1y agoNot sure where youve learnt that Lua gives you access to the AST considering Lua doesn't build an AST
- trenchpilgrim 1y agoI gotta admit I never formally learned Lua in any rigorous way, I just picked up enough to script with it in existing codebases. I'll often write Python scripts that manipulate Lua programs, for example.