This function is supposed to take a list of automata (where is state is just accepting or not), labeled with values of type Result and combine them into one automaton with states with generalized result(). The resulting automaton accepts exactly the union of languages accepted by automata on input, but also distinguishes accepting states for each Result.
In case we detect that the grammar is ambiguous (some state in resulting DFA has at least two possible result values), then we decided to throw an error ("Ooops! It looks like cacophony has an ambiguous grammar:(").
We need a function with following signature
This function is supposed to take a list of automata (where is state is just accepting or not), labeled with values of type
Result
and combine them into one automaton with states with generalizedresult()
. The resulting automaton accepts exactly the union of languages accepted by automata on input, but also distinguishes accepting states for eachResult
.In case we detect that the grammar is ambiguous (some state in resulting DFA has at least two possible
result
values), then we decided to throw an error ("Ooops! It looks like cacophony has an ambiguous grammar:(").