uwol / proleap-cobol-parser

ProLeap ANTLR4-based parser for COBOL
MIT License
137 stars 76 forks source link

How can i store the generated AST in JSON format? #94

Open RajSakpal opened 1 year ago

sundar-sarvam commented 1 year ago

Any updates on this issue? Storing the AST in a JSON format will be immensely helpful!

uwol commented 1 year ago

To serialize the AST, this would be a ANTLR topic, discussed here https://github.com/antlr/antlr4/discussions/3772 with some code here https://github.com/antlr/antlr4/pull/3773

To serialize the ASG, one could try to pass the resulting ASG into Jackson ObjectMapper. However there will be circular references -> some @JsonIgnore annotations would be necessary.