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

Add LOC counting to SANY #918

Open
lemmy opened this issue Apr 26, 2024 · 2 comments
Open

Add LOC counting to SANY #918

lemmy opened this issue Apr 26, 2024 · 2 comments
Labels
enhancement Lets change things for the better SANY Issues involving SANY's analysis

Comments

@lemmy
Copy link
Member

lemmy commented Apr 26, 2024

microsoft/CCF#6152 is an ad hoc LOC counter for TLA+. @ahelwer Do you know enough about parsing TLA+ in general and SANY in particular to estimate how difficult it would be to build this into SANY?

@lemmy lemmy added enhancement Lets change things for the better SANY Issues involving SANY's analysis labels Apr 26, 2024
@ahelwer
Copy link
Contributor

ahelwer commented Apr 26, 2024

Assuming we want to count "lines containing at least one element of non-comment TLA+ syntax" one possible algorithm would be to iterate over all leaf nodes in the parse tree and add their line numbers to a set (start/end lines should be the same for leaf nodes), then get the cardinality of that set. If you want to make a more scientific measure that you could use to, for example, compare the line counts of different specs then you would want to write a TLA+ code formatter first which does not yet exist and would be quite a lot of work.

@lemmy
Copy link
Member Author

lemmy commented Apr 26, 2024

I guess this could be implement as an tla2sany.explorer.ExplorerVisitor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Lets change things for the better SANY Issues involving SANY's analysis
Development

No branches or pull requests

2 participants