Open ccatrett opened 1 week ago
I understand the request; it seems reasonable to me. It's worth noting that the JSON is never going to contain the full breadth and depth of information available in the C++ AST; it's simply not feasible to serialize every possible thing because the JSON would explode in size, so depending on your use case you may want to consider using the library directly. Having the type information broken out in the JSON directly does seem useful and fairly straightforward to do though.
Is your feature request related to a problem? Please describe. My feature request is not related to a problem with slang.
Describe the solution you'd like For completeness, here is a minimal.svh file:
Running
slang --ast-json - minimal.svh
yields the following output:I would like an option to make the
target
field be presented in a more hierarchical easier extraction of data. Currently, thetarget
field is useless to me since I don't have a parser to extract the bit widths of the signals in the provided format. Viewing is great, but crucially, I cannot extract any of the details of thetarget
field easily.Describe alternatives you've considered I have considered other parsers, but none of them give output in a form as close to what I need as slang does. I have also considered extracting information based on opening and closing curly braces, but this seems inefficient and overly complex considering that
target
is a raw SystemVerilog string with additional parsing symbols.The pieces of information I need to extract are the names and widths of each variable in the
target
field for a TypeAlias. If there is any efficient way of doing this, I would appreciate some guidance in the right direction.