Of Your Code Does Not Store Everything - It is abstract e.g. Does not store that a JS function starts/ends with open/close curly brackets Can Be Traversed and Updated
Whenever you want to analyze your code Couldn't I Just Use Regular Expressions? Pattern matching will only get you so far. It is also notoriously ugly to read. How Do I Generate An AST? By Using A Parser Library (or writing your own parser)
there are alternatives out there. A popular alternative is Acorn Why Does Esprima Adhere To The Mozilla SpiderMonkey Parser API? Because the SpiderMonkey Parse API is recognized by the community as a standard for structured JS representation (and many other tools adhere to it as well)
there are alternatives out there. A popular alternative is esquery But Couldn't I Traverse And Update The AST Myself? You could, but traversing ASTs is tricky since not all AST child nodes have a unified interface. e.g. VariableDeclaration has nested children nodes within a declarations property, while an IfStatement has nested children within a consequent property.
question. I'm not sure of a good alternative. Anyone in the audience know? But Couldn't I Write an AST Code Generator Myself? You could. I'll see you next year, when you're finished.
Anything More Complex? Yep, check out the AMDClean website and source You Didn't Cover CSS Static Analysis. What Gives? Not enough time my friend. But I created an example that you can look at later. Are There Any More Resources You Would Recommend? Yes, the Esprima Parser Demo and the Mozilla SpiderMonkey Parser API will be your best friends. You current best friends will understand.