File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed
src/commonMain/kotlin/ai/hypergraph/kaliningraph/parsing Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -38,11 +38,10 @@ private class FrozenCFG(val cfg: CFG): CFG by cfg {
3838
3939val CFG .language: CFL by cache { CFL (this ) }
4040val CFG .delimiters: Array < Σᐩ> by cache { (terminals.sortedBy { - it.length } + arrayOf(HOLE_MARKER , " " )).toTypedArray() }
41- val CFG .nonterminals: Set < Σᐩ> by cache { map { it.LHS }.toSet() }
41+ val CFG .nonterminals: Set < Σᐩ> by cache { setOf ( START_SYMBOL ) + map { it.LHS }.toSet() }
4242val CFG .symbols: Set < Σᐩ> by cache { nonterminals + flatMap { it.RHS } }
4343val CFG .terminals: Set < Σᐩ> by cache { symbols - nonterminals }
44- val CFG .terminalUnitProductions: Set <Production >
45- by cache { filter { it.RHS .size == 1 && it.RHS [0 ] !in nonterminals } }
44+ val CFG .terminalUnitProductions: Set <Production > by cache { filter { it.RHS .size == 1 && it.RHS [0 ] !in nonterminals } }
4645val CFG .unitProductions: Set <Pair <Σᐩ, Σᐩ>> by cache { filter { it.RHS .size == 1 }.map { it.LHS to it.RHS [0 ] }.toSet() }
4746val CFG .nonterminalProductions: Set <Production > by cache { filter { it !in terminalUnitProductions } }
4847val CFG .unitNonterminals: Set < Σᐩ> by cache { terminalUnitProductions.map { it.LHS }.toSet() }
@@ -240,7 +239,6 @@ class JoinMap(val CFG: CFG) {
240239}
241240
242241// Maps indices to nonterminals and nonterminals to indices
243- // TODO: Would be nice if START had a zero index (requires rebuilding caches)
244242class Bindex <T >(
245243 val set : Set <T >,
246244 val indexedNTs : List <T > = set.toList(),
You can’t perform that action at this time.
0 commit comments