How can I compile CoffeeScript AST in CoffeeScript instead of JavaScript?

Can I turn AST back into CoffeeScript instead of JavaScript? The project I'm working on basically requires turning all CoffeeScript into an AST, analyzing the AST, and then turning parts of the AST back into CoffeeScript. I understand that converting back would be "lost" in relation to the source code, but this is normal.

I would really like to avoid compiling these parts in JavaScript and then back to CoffeeScript.

+5
source share
2 answers

See round_trip.coffee in the CoffeeCoffee project (I am the author):

I do not consider every case, but this is the beginning.

+4

, , Coffeescript. , Coffeescript , , AST. coffee- script/src Github.

coffee- script/src/nodes.coffee, Node , (, compile(), compileNode() ..). , javascript-. Coffeescript , .

+3

All Articles