Generating S-Expression Dumps for Sail, JIB, and SV_ir ASTs #780
NicolasVanPhan
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all,
I thought it would be useful to have a way to print ASTs (Sail, JIB, SV_ir, etc.) with the exact names of the AST nodes used. The current pretty-printer doesn't provide the precise names of the AST nodes, whereas a S-expression (sexp) dump would, which could be beneficial for debugging.
To achieve this, it would involve adding
[@@deriving sexp]
to all the relevant types in ast.ml, jib.ml, and similar files. However, since these files are generated from thejib.ott
file (which creates ajib.lem
file, and subsequently ajib.ml
file), direct modification is not straightforward. I attempted to use Ott's embed directive to insert the annotations, but embeddings (embed
keyword) only seem to work at the top of the file, before the grammar definitions.Has anyone tried adding S-expression support before? Is there a feasible way to achieve this within the current setup? Any insights or suggestions would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions