Open OddLingo opened 4 years ago
I see that the grammar-kit/README.md
file has not changed since 2015. It contains this text:
If you want to use an "infinite loop" in part of your grammar, you should write a
recursion rule like this (only left-recursion is allowed):
S: NS_B WORD_LOOP NS_E
WORD_LOOP: WORD_LOOP WORD
WORD_LOOP: WORD
Yet when I look at the module nfa.c
in the mkfa
program, it contains code that checks for recursion and generates the error message I have encountered if it sees "left recursion". And that code is just as old as the README, from 2015.
So I am not clear on how I ever got this working before. And I am stuck for now.
I've found a bug in mkdfa and have fixed it just now. Could you try the latest version on the master branch?
Why the description differs between README and mkfa codes:
Why left recursion makes error while right recursion does not in recent version:
I hope this fix helps you.
I can confirm that I also saw the problem("Error: Left recusion is formed in class") reported by OddLingo using the release version 4.6.
Following the suggestion of nitslp-ri, I downloaded the latest master as of July 13, 2021, and I can confirm that the problem is now fixed. I can process my grammer without any error. Thank you, nitslp-ri.
From my point of view, I think this fix is ready for the next release.
The Julius documentation has always said that only left recursion can be used in grammars and I have always used it that way.. Yet now when I submit a grammar like this:
I get a message from mkdfa.pl saying "Error: Left recusion is formed in class,"NOUNP"
If I reverse the terms in the definition of NOUNP as follows:
Then it completes without error, yielding this dfa file:
Is there new guidance on writing grammar files?