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

implement a tool for verifying language grammars #12

Merged
merged 9 commits into from
Aug 3, 2024

Conversation

zerbina
Copy link
Collaborator

@zerbina zerbina commented Aug 2, 2024

The passtool currently only performs some basic checks (i.e., whether
all references name existing rules and that no duplicate productions
are introduced).

In the future, it'll also provide code-generation facilities for
automating the creation of validation layers for languages. The idea is
to reduced the overhead of removing, changing, or adding new
intermediate languages as much as possible.

The tool is ran as part of CI to make sure all language grammars are
valid.

zerbina added 6 commits August 2, 2024 21:36
It's a simple parser based on `lexbase`; there's not much too it. The
interface is structured around an iterator.
Ambiguity detection and checking for non-terminating rules is missing,
but can still be implemented later on.
It's still missing much of the planned functionality.
This ensures the grammar for each language is correct before merging.

No code is actually generated for the languages at the moment, but it
will be in the future. Koch and the passtool are quick enough to build,
so the executables aren't shared between the `binaries` job and
`languages` job.
@zerbina zerbina added the enhancement New feature or request label Aug 2, 2024
Copy link
Contributor

@saem saem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great!

Wow, I thought this tool might have been out of reach for a while, but this is really nice. 🚀

tools/passtool/parser.nim Outdated Show resolved Hide resolved
@saem
Copy link
Contributor

saem commented Aug 3, 2024

I didn't merge it in case there was more to it than waiting for the merge of the other PR, apologies if that was the only blocker.

@zerbina zerbina marked this pull request as ready for review August 3, 2024 19:30
@zerbina
Copy link
Collaborator Author

zerbina commented Aug 3, 2024

I didn't merge it in case there was more to it than waiting for the merge of the other PR, apologies if that was the only blocker.

No no, it's all good. The reason I wanted to wait with merging was so that I can update CI to test lang1 instead of lang0.

@zerbina zerbina merged commit 162e7e6 into nim-works:main Aug 3, 2024
5 checks passed
@zerbina zerbina deleted the implement-pass-tool branch August 3, 2024 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants