Closed kuniss closed 2 years ago
It's because the start symbol is not productive, so that no code is generated for it! Strange things happen, if you forcefully set the start symbol to be productive (segmentation fault caused by infinite loop in error recovery mode).
When writing a grammar piece by piece, it can be helpful to generate compilers even if there are non-terminals that are not (yet) productive ("unfinished business"). Therefore, the compiler generation should only be aborted if the start symbol itself is not productive.
(Later on, we can add a general option "treat warnings as errors" for finished grammars.)
You mean, I should adapt the PR #12 to report an error only if the start symbol is affected? However, if a different non-terminal than the start symbol is affected, a warning is sufficient and a compiler should be generated and D-compiled.
If nonterminals are unproductive the compiler generator does not fail but issues a warning only. However, the subsequently running D compiler almost fail due to a missing method.
It would be appreciated if the compiler generator already fails for unproductive terminals and only succeeds if it is forced to do so (with command line argument "--force").
Example for reproduction:
The example results with epsilon in the following output: