Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addition of a abstract syntax tree to source code printer #1113

Open
wants to merge 68 commits into
base: master
Choose a base branch
from

Conversation

jeffKeysight
Copy link

@jeffKeysight jeffKeysight commented Sep 6, 2024

his pull request introduces the initial implementation of an AST to Source Code Printer as part of a recent internship project. The goal of this addition is to enable the conversion of AST representations back into human-readable source code. Currently, the functionality is limited to handling simple programs, more complex programs may not be accurately represented yet. The current version lacks support for 'property', 'checker', 'cover', and 'generate' statements, although it does provide basic support for other elements .

changes to the orginal AST are the addition of a 'name' member to the CovergroupType and corresponding updates to the JSON AST printer. A 'isDuplicate' flag has been introduced to VariableFlags to track duplicate information. Furthermore, a 'MinimalInfoEnabled' option has been added to the serializer, producing a JSON output with reduced information, facilitating the comparison of different ASTs for equivalence.

A test suite based on the 'all.sv' file has been made. Programs are validated by running the AST printer and comparing the resulting AST of the generated source code against the original code's AST. This comparison is made through the json representation.

(The workflow currently fails but i am currently developing a fix for this)

inigo-easics and others added 30 commits June 28, 2024 23:41
…ble to make a subclass using this class see exampleDiagnostic.py
…ree in python. The syntaxFactory bindings do not work yet.
…done this way because the information needed to remake the source code (the genvar expresion, itteration,....) are not present in the ast.I added more binary operators and made cosmetic changes to InstanceBody
Jeff Jambe and others added 28 commits August 30, 2024 11:51
…ow possible to make a subclass using this class see exampleDiagnostic.py"

This reverts commit c646605.
… to making it compatible with the changes in the ast
@jeffKeysight jeffKeysight marked this pull request as ready for review September 6, 2024 16:48
@MikePopoloski
Copy link
Owner

Thanks for submitting a PR. Please get the tests and pre-commit checks to pass and revert any changes that aren't required to be part of this diff, such as the changes to the build workflow. Also from a higher level point of view I'm not against adding a printer for the AST but I'm curious what your use case is and whether the printer really needs to live in the slang library or could just exist in a downstream application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants