#Editing Large Legacy Codebases with an Abstract Syntax Tree
##Abstract
I recently had to make changes across 100+ legacy Javascript files that could not be made via regexp search-and-replace [1]. To make this faster(?) and less typo-prone, I used Node.js and Rocambole to extract an abstract syntax tree (AST), edit it (and the associated token stream), and output the result. In this talk, I'll discuss what an AST is, my particular code transformation, how to edit code with a tool like Rocambole, and even implement a micro-Javascript interpreter.
While I don't do anything particularly novel or unique with the AST, I found the technique useful and enlightening — and, if you've never looked at an AST before, I think you will, too.
[1] For instance, I had to change code from (you'll see why it had to get changed…)
var a = "index.php?new=" + b.c;
eval( "my_iframe.location = '" + a + "'" );
to
io.frameGET( "index.php", {
"new": b.c
}, document.getElementById( "my_iframe" ) );
##Speaker Bio
I've been developing professionally for the web for four years, but have programmed in my spare time for many more. I currently work at Icon Systems, Inc., where I am lead developer on IconCMO: software to track membership, contributions, and accounting for churches and other non-profits. I love creating tools that enrich and help the lives of everyday people.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。