Open machard opened 2 years ago
Unless I did not understand properly, I want to do the other side : write the cairo file after I played with the AST
(Yes, sorry, I misunderstood your question at first)
There is no direct way to do that. You'll have to write a transformer that generates a cairo file from an AST.
You can use the line/column information to restore the same whitespace, and it's also possible to collect the ignore tokens into an array, using lexer_callbacks
.
thank you. I am a bit new to this, it's called a generator or serializer ? I think https://babeljs.io/docs/en/babel-generator is turning js ast to js code, do you have maybe other example of such tool ?
You can call it a code generator. I don't think serializer is the same thing.
Hi, Let's say I use https://github.com/crytic/amarna/blob/main/amarna/grammars/cairo.lark and https://github.com/lark-parser/Lark.js to get the AST tree of a cairo file. What do I use after to generate a cairo file from the AST ? Thank you