Hacker News new | past | comments | ask | show | jobs | submit login

I also like Clang Tools for C++ AST and programmatic refactoring. Much better than regex replace. What exactly is the benefit of Codemod? Too me it seems like a glorified regex replacer, nothing more.

Suppose you have a function Foo::bar() and Bar::bar(). You decide to replace Bar::bar() by Bar::foo(). Good look with doing that via regex. Foo::bar() calls will most likely be affected as well. Matching directly on the AST solves this problem by explicitely matching all Bar::bar() calls.

What I really want: a language agnostic abstract syntax tree parser, matcher and transformer.

AST matchers and Clang refactoring tools: http://eli.thegreenplace.net/2014/07/29/ast-matchers-and-cla...

Refactoring C++ with Clang with cool examples: https://www.youtube.com/watch?v=yuIOGfcOH0k

Clang rename refactoring tool: https://clang.llvm.org/extra/clang-rename.html




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: