0

CoffeeScript provides a way to obtain an AST (abstract syntax tree) from CoffeeScript code. But I can't seem to find a simple way to then convert the AST into JavaScript. I realize that I can directly convert CoffeeScript to JavaScript - that's what the CoffeeScript project is all about. But what if I want to get an AST, make some changes to it, then generate JavaScript from that? Or if I want to generate a CoffeeScript compatible AST on the fly (e.g. from a language that I design), then generate JavaScript from that?

I've spent some time on their source code and it appears that their AST is imbedded in a more complex data structure. That data structure has methods to generate JavaScript, but if you ask for an AST, that capability is removed.

To be clear: what I want is to take an AST, obtained from CoffeeScript by setting the 'ast' option on the compile() function. Then obtain JavaScript code using only the AST.

    0

    Start asking to get answers

    Find the answer to your question by asking.

    Ask question

    Explore related questions

    See similar questions with these tags.