Open blenderskool opened 2 years ago
TLDR; Cool project. Would like to contribute and understood the issue you mentioned too. Will explore about this more and update you. Also any place you think this test section would look good?
Hello @blenderskool , was hunting projects for fosshack and had eye on this project from past 3 days. So i set it up locally and was experimenting around it. Cool project first of all. I am not that familiar with vue, but I would love to learn it just because of vyaakaran. Just wanted to know where do you think the test section would look cool? Like any UI pattern you think, would look better? (as you may know better)
@nishaaannnt I think it should look good next to the console section. We can have both of them as tabs with default being console. The user can click on "Tests" tab and the console area will change to the tests interface. Of course, we can change the location later too if this doesn't look good.
@blenderskool Is the issue still open. Can we work on this.
Rough idea that occurred to me while using Vyaakaran
The way I write grammars usually has following iterations:
This approach makes writing complex grammars simpler as you don't have to think about fine details at the start. But it also has a downside of causing unexpected changes in the intended language the grammar represents as you extend it in every iteration.
With a TDD approach, I would be able to define some sample tests of strings that I'd always want my language to accept / reject. These tests would always run when I compile the grammar and let me know if any of my tests are failing. In case a test fails, it indicates my grammar has deviated somewhere and is no longer representing the language I intend it to.
For someone interested to work on this:
Take references from:
Vyaakaran already has the pieces in the compiler to test whether a string gets accepted, rejected, or accepted with ambiguity by the grammar. Thus, no new functionality needs to be added in the compiler itself. Check the existing console code to see how the
test
command works: https://github.com/blenderskool/vyaakaran/blob/c541405f04033badbf9994cc50572e6f80c3886b/editor/src/config/console.ts#L125-L138A new section in the UI must be added for Regular Grammars and Context Free Grammars where the user can define a list of test strings (acceptable / unacceptable) and whenever the user compiles their grammar, all the test strings are tested against the grammar and the result is visually displayed for each test with appropriate colors.