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

output AST #801

Open
eisbaer66 opened this issue May 13, 2022 · 1 comment
Open

output AST #801

eisbaer66 opened this issue May 13, 2022 · 1 comment
Labels
compiler Problems with the compiler parsing source code. enhancement

Comments

@eisbaer66
Copy link

Is there an option to only generate the AST and output it (to stdout or a file) without actually generating a smx?
Would be interesting for tools like editors (showing errors etc.) and other static analysis.
Might for example allow to check if all natives in a include-file have a registered implementation, find all references of a variable or check for naming conventions etc.

Maybe something like spcomp --ast-output stdout or spcomp --ast-output ./ast.json would work?
Using it in combination with --syntax-only would skip the generation of smx-files and only output the AST instead.

I'd expect a JSON format, but maybe providing options to use different formats (or using a different format altogether) makes sense. Could use --ast-format json or similar to specify the format (on top of --ast-output ...).

@dvander
Copy link
Member

dvander commented May 13, 2022

I have a WIP patch for this but don't want to merge it without a separate 1.11 branch. It refactors the AST a bit.

@peace-maker peace-maker added enhancement compiler Problems with the compiler parsing source code. labels Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler Problems with the compiler parsing source code. enhancement
Projects
None yet
Development

No branches or pull requests

3 participants