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

Revert incorrect optimizations to JSGF compiler (fixes #53) #305

Merged
merged 8 commits into from
Sep 29, 2022

Conversation

dhdaines
Copy link
Contributor

Also verify the correctness of the test grammars, with a new utility function that does this.

The optimization was, in theory, a good idea, perhaps it can be done correctly, now that we can properly verify the correctness of the resulting grammars.

Original commit was cmusphinx/sphinxbase@e59cac4

The resulting FSGs are, yes, quite bad, but the optimization was incorrect, and the
proposed fix for it did not actually fix the problem, but made the code more
complex.  In general I think the Knuth quote about premature optimization is
just an excuse for people to write bad code, but in this case it seems pertinent
The change I reverted was *partially* correct as it noted that a right-recursive rule
cannot reach the final state on its own, so put this change back
with the side effect that it verifies the correctness of the
tests in test-sphinx_jsgf2fsg.sh
@dhdaines dhdaines linked an issue Sep 29, 2022 that may be closed by this pull request
@dhdaines dhdaines merged commit 8c7d785 into master Sep 29, 2022
@dhdaines dhdaines deleted the 53-jsgf-grammer-not-working-as-expected branch September 29, 2022 00:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

JSGF Grammer not working as expected
1 participant