Open Kuinox opened 2 years ago
Hello @Kuinox, this is something that can be easily done using Scriban templates (and you can customize the output more than what Farkle would be able to do), but judging from our conversation on Discord, what you actually want is to get the BNF of a precompiled grammar with conflicts.
Other than conflict reports, Farkle does not currently support interacting with grammars that fail to build. Farkle used to have a setting that emits warnings instead of errors when the grammar fails to build, but I removed it in an alpha version of Farkle 6 when buildPrecompiled
stopped falling back to building at run-time.
This is something I plan to improve in Farkle 7, but it will take some time until I can work on it. I might bring it sooner to a Farkle 6.5.0 version, but only if the Endgame needs it.
To solve your problem, you need to disable the precompiler, call Farkle.Builder.DesigntimeFarkleBuild.CreateGrammarDefinition
with your designtime Farkle as an argument, and you will get a GrammarDefinition
object. This object will contain your grammar's terminals, nonterminals and productions, giving you enough information about it to create a BNF representation.
I don't plan of doing it for now.
I may give a try the day i'll have a conflict I can't diagnose with current tooling. (I wanted to use the BNF grammar to feed it in other tools that help diagnose this.)
Having a BNF grammar output would allow that the grammar written with Farkle to be used in other tools.