Skip to content

Possible to round trip File -> AST -> JSON -> AST -> File? #766

Answered by MikePopoloski
eteran asked this question in Q&A
Discussion options

You must be logged in to vote

To answer your question directly, there isn't currently any functionality to parse JSON and turn it into an AST. Such a thing is of course possible but it would require a fair amount of work.

Also to further clarify, the AST itself doesn't turn back into Verilog code nicely. The AST is "abstract" in the sense that it no longer directly represents what the user typed, so for example various input forms get normalized into one representation in the AST. The "concerete" syntax tree (in slang represented by SyntaxNode and Token objects, encapsulated in the SyntaxTree class) does round trip back to source code as an explicit design goal, but there isn't currently a way to turn that tree into J…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by eteran
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants