To get an idea of what kinds of things you can do but in a language that might be familiar to you, just look at all the tools built around an AST parsing library like Esprima. Basically you get all that kind of magic, but in a way that is native to the language and natural to work with due to homoiconic syntax (s-expressions).