diff --git a/solver/build.gradle.kts b/solver/build.gradle.kts index ef4c2afc6..c234a8ef2 100644 --- a/solver/build.gradle.kts +++ b/solver/build.gradle.kts @@ -11,12 +11,16 @@ repositories { dependencies { implementation("org.jetbrains.kotlinx:kotlinx-cli:0.3.5") - implementation("com.fasterxml.jackson.core:jackson-core:2.14.0") - implementation("com.fasterxml.jackson.core:jackson-databind:2.14.0") + implementation ("io.github.oshai:kotlin-logging-jvm:5.1.0") + //needed for .dot parsing + implementation("org.antlr:antlr4:4.13.1") + // https://mvnrepository.com/artifact/org.slf4j/slf4j-api + //needed for kotlin-logging + implementation("org.slf4j:slf4j-api:2.0.17") + implementation("ch.qos.logback:logback-classic:1.5.18") testImplementation(kotlin("test")) testImplementation("org.junit.jupiter:junit-jupiter:5.8.1") - implementation("org.antlr:antlr4:4.13.1") } kotlin { jvmToolchain(11) } diff --git a/solver/src/main/kotlin/org/ucfs/descriptors/Descriptor.kt b/solver/src/main/kotlin/org/ucfs/descriptors/Descriptor.kt index b31854a05..3ef1e4469 100644 --- a/solver/src/main/kotlin/org/ucfs/descriptors/Descriptor.kt +++ b/solver/src/main/kotlin/org/ucfs/descriptors/Descriptor.kt @@ -27,5 +27,17 @@ data class Descriptor( */ val sppfNode: RangeSppfNode, -) +) { + // debug only property + val id = lastId++ + override fun toString(): String { + return "${id}\t;" + + "${inputPosition}\t;" + + "${rsmState.id}\t;" + + "(${gssNode.inputPosition}, ${gssNode.rsm.id})\t;" + + "sppf: ${sppfNode.id} " + } +} + +var lastId = 0 diff --git a/solver/src/main/kotlin/org/ucfs/descriptors/DescriptorsStorage.kt b/solver/src/main/kotlin/org/ucfs/descriptors/DescriptorsStorage.kt index 4e79bb00c..2cd069b79 100644 --- a/solver/src/main/kotlin/org/ucfs/descriptors/DescriptorsStorage.kt +++ b/solver/src/main/kotlin/org/ucfs/descriptors/DescriptorsStorage.kt @@ -1,5 +1,6 @@ package org.ucfs.descriptors +import io.github.oshai.kotlinlogging.KotlinLogging import org.ucfs.parser.ParsingException /** @@ -7,6 +8,8 @@ import org.ucfs.parser.ParsingException * @param VertexType - type of vertex in input graph */ open class DescriptorsStorage { + private val logger = KotlinLogging.logger {} + /** * Collection of already handled descriptors, accessible via descriptor's hashcode */ @@ -31,10 +34,12 @@ open class DescriptorsStorage { } fun add(descriptor: Descriptor) { - if(!handledDescriptors.contains(descriptor)){ + logger.debug { "+d:${descriptor.id}" } + if (!handledDescriptors.contains(descriptor)) { descriptorsToHandle.addLast(descriptor) } } + /** * Gets next descriptor to handle * @return default descriptor if there is available one, null otherwise diff --git a/solver/src/main/kotlin/org/ucfs/grammar/combinator/Grammar.kt b/solver/src/main/kotlin/org/ucfs/grammar/combinator/Grammar.kt index abc205a51..227491583 100644 --- a/solver/src/main/kotlin/org/ucfs/grammar/combinator/Grammar.kt +++ b/solver/src/main/kotlin/org/ucfs/grammar/combinator/Grammar.kt @@ -12,6 +12,7 @@ open class Grammar { val nonTerms = ArrayList() private lateinit var startNt: Nt + private lateinit var fictitiousStartNt: Nt private var _rsm: RsmState? = null val rsm: RsmState @@ -22,12 +23,6 @@ open class Grammar { return _rsm!! } - fun setStart(expr: Regexp) { - if (expr is Nt) { - startNt = expr - } else throw IllegalArgumentException("Only NT object can be start state for Grammar") - } - fun Nt.asStart(): Nt { if (this@Grammar::startNt.isInitialized) { throw Exception("Nonterminal ${nonterm.name} is already initialized") @@ -43,6 +38,8 @@ open class Grammar { private fun buildRsm(): RsmState { nonTerms.forEach { it.buildRsmBox() } //if nonterminal not initialized -- it will be checked in buildRsmBox() - return startNt.nonterm.startState + fictitiousStartNt = Nt(startNt, "fictiveStart") + fictitiousStartNt.buildRsmBox() + return fictitiousStartNt.nonterm.startState } } diff --git a/solver/src/main/kotlin/org/ucfs/grammar/combinator/regexp/Nt.kt b/solver/src/main/kotlin/org/ucfs/grammar/combinator/regexp/Nt.kt index a9d5f6949..6feb8aafe 100644 --- a/solver/src/main/kotlin/org/ucfs/grammar/combinator/regexp/Nt.kt +++ b/solver/src/main/kotlin/org/ucfs/grammar/combinator/regexp/Nt.kt @@ -10,6 +10,11 @@ open class Nt() : DerivedSymbol { constructor(lhs: Regexp) : this() { rsmDescription = lhs } + constructor(lhs: Regexp, name: String) : this() { + rsmDescription = lhs + this.nonterm = Nonterminal(name) + } + lateinit var nonterm: Nonterminal private set diff --git a/solver/src/main/kotlin/org/ucfs/parser/Gll.kt b/solver/src/main/kotlin/org/ucfs/parser/Gll.kt index 6359a3f59..a4dd174c3 100644 --- a/solver/src/main/kotlin/org/ucfs/parser/Gll.kt +++ b/solver/src/main/kotlin/org/ucfs/parser/Gll.kt @@ -1,5 +1,6 @@ package org.ucfs.parser +import io.github.oshai.kotlinlogging.KotlinLogging import org.ucfs.descriptors.Descriptor import org.ucfs.gss.GssEdge import org.ucfs.input.IInputGraph @@ -18,6 +19,7 @@ import org.ucfs.sppf.node.* class Gll private constructor( override var ctx: Context, private val engine: IIntersectionEngine ) : IGll { + val logger = KotlinLogging.logger {} companion object { /** @@ -29,7 +31,8 @@ class Gll private constructor( fun gll( startState: RsmState, inputGraph: IInputGraph ): Gll { - return Gll(Context(startState, inputGraph), IntersectionEngine) + val finalState = startState.outgoingEdges[0].destinationState + return Gll(Context(startState, finalState, inputGraph), IntersectionEngine) } } @@ -66,33 +69,47 @@ class Gll private constructor( ctx.descriptors.add(newDescriptor) } + private fun isParseResult(matchedRange: RangeSppfNode): Boolean { + return matchedRange.inputRange!!.from in ctx.input.getInputStartVertices() + && matchedRange.rsmRange!!.from == ctx.fictiveStartState + && matchedRange.rsmRange.to == ctx.fictiveFinalState + } + /** * Processes descriptor * @param descriptor - descriptor to process */ override fun handleDescriptor(descriptor: Descriptor) { ctx.descriptors.addToHandled(descriptor) + logger.debug { "\n${descriptor}\t" } if (descriptor.rsmState.isFinal) { - val matchedRange = if (descriptor.sppfNode.type is EmptyType) { - val node = getEpsilonRange(descriptor) - //TODO fix - // dirty hack: in fact it's equivavelnt descriptors - // but only initial was added in handlet set - ctx.descriptors.addToHandled(Descriptor(descriptor.inputPosition, - descriptor.gssNode, descriptor.rsmState, node)) - node - } else { - descriptor.sppfNode - } - for (poppedEdge in ctx.gss.pop(descriptor, matchedRange)) { - handlePoppedGssEdge(poppedEdge, descriptor, matchedRange) - } - if (descriptor.gssNode.outgoingEdges.isEmpty() && descriptor.gssNode.rsm.isStart) { - ctx.parseResult = matchedRange - } + handleTerminalRsmState(descriptor) } - engine.handleEdges(this, descriptor) } + + private fun handleTerminalRsmState(descriptor: Descriptor) { + val matchedRange = if (descriptor.sppfNode.type is EmptyType) { + val node = getEpsilonRange(descriptor) + //TODO fix + // dirty hack: in fact it's equivavelnt descriptors + // but only initial was added in handled set + ctx.descriptors.addToHandled( + Descriptor( + descriptor.inputPosition, + descriptor.gssNode, descriptor.rsmState, node + ) + ) + node + } else { + descriptor.sppfNode + } + for (poppedEdge in ctx.gss.pop(descriptor, matchedRange)) { + handlePoppedGssEdge(poppedEdge, descriptor, matchedRange) + } + if (isParseResult(matchedRange)) { + ctx.parseResults.add(matchedRange) + } + } } diff --git a/solver/src/main/kotlin/org/ucfs/parser/IGll.kt b/solver/src/main/kotlin/org/ucfs/parser/IGll.kt index fd7576418..16d55cc84 100644 --- a/solver/src/main/kotlin/org/ucfs/parser/IGll.kt +++ b/solver/src/main/kotlin/org/ucfs/parser/IGll.kt @@ -25,8 +25,8 @@ interface IGll { * Main parsing loop. Iterates over available descriptors and processes them * @return Pair of derivation tree root and collection of reachability pairs */ - fun parse(): RangeSppfNode? { - ctx.parseResult = null + fun parse(): Set> { + ctx.parseResults = HashSet() initDescriptors(ctx.input) var curDescriptor = ctx.descriptors.nextToHandle() @@ -36,7 +36,7 @@ interface IGll { curDescriptor = ctx.descriptors.nextToHandle() } - return ctx.parseResult + return ctx.parseResults } /** @@ -52,9 +52,9 @@ interface IGll { fun initDescriptors(input: IInputGraph) { for (startVertex in input.getInputStartVertices()) { - val gssNode = ctx.gss.getOrCreateNode(startVertex, ctx.startState) + val gssNode = ctx.gss.getOrCreateNode(startVertex, ctx.fictiveStartState) val startDescriptor = Descriptor( - startVertex, gssNode, ctx.startState, getEmptyRange() + startVertex, gssNode, ctx.fictiveStartState, getEmptyRange() ) ctx.descriptors.add(startDescriptor) } @@ -76,16 +76,16 @@ interface IGll { for (rangeToPop in positionToPops) { val leftSubRange = descriptor.sppfNode val rightSubRange = ctx.sppfStorage.addNonterminalNode( - rangeToPop.inputRange!!, RsmRange( - descriptor.rsmState, destinationRsmState - ), rsmStartState - ) + rangeToPop.inputRange!!, RsmRange( + descriptor.rsmState, destinationRsmState + ), rsmStartState + ) val newSppfNode = ctx.sppfStorage.addIntermediateNode(leftSubRange, rightSubRange) //TODO why these parameters??? newDescriptor = Descriptor( - rangeToPop.inputRange!!.to, descriptor.gssNode, destinationRsmState, newSppfNode + rangeToPop.inputRange.to, descriptor.gssNode, destinationRsmState, newSppfNode ) ctx.descriptors.add(newDescriptor) } @@ -98,7 +98,7 @@ interface IGll { destinationRsmState: RsmState, terminal: ITerminal ) { - var terminalSppfNode = ctx.sppfStorage.addNode( + val terminalSppfNode = ctx.sppfStorage.addNode( InputRange( descriptor.inputPosition, inputEdge.targetVertex, diff --git a/solver/src/main/kotlin/org/ucfs/parser/context/Context.kt b/solver/src/main/kotlin/org/ucfs/parser/context/Context.kt index a18eefef4..34276eaad 100644 --- a/solver/src/main/kotlin/org/ucfs/parser/context/Context.kt +++ b/solver/src/main/kotlin/org/ucfs/parser/context/Context.kt @@ -1,6 +1,5 @@ package org.ucfs.parser.context -import org.ucfs.descriptors.Descriptor import org.ucfs.descriptors.DescriptorsStorage import org.ucfs.gss.GraphStructuredStack import org.ucfs.input.IInputGraph @@ -14,11 +13,12 @@ import org.ucfs.sppf.node.RangeSppfNode * @param InputNodeType - type of vertex in input graph * @param LabelType - type of label on edges in input graph */ -class Context ( +class Context( /** * Starting state of accepting Nonterminal in RSM */ - val startState: RsmState, + val fictiveStartState: RsmState, + val fictiveFinalState: RsmState, val input: IInputGraph @@ -33,8 +33,8 @@ class Context ( * Derivation trees storage */ val sppfStorage: SppfStorage = SppfStorage() - + val gss: GraphStructuredStack = GraphStructuredStack() - var parseResult: RangeSppfNode? = null + var parseResults = HashSet>() } \ No newline at end of file diff --git a/solver/src/main/kotlin/org/ucfs/rsm/RsmWrite.kt b/solver/src/main/kotlin/org/ucfs/rsm/RsmWrite.kt index 0e36732e6..ec275bfbc 100644 --- a/solver/src/main/kotlin/org/ucfs/rsm/RsmWrite.kt +++ b/solver/src/main/kotlin/org/ucfs/rsm/RsmWrite.kt @@ -87,7 +87,7 @@ fun writeRsmToTxt(startState: RsmState, pathToTXT: String) { } fun writeRsmToDot(startState: RsmState, filePath: String) { - val states = getAllStates(startState) + val states = getAllStates((startState.outgoingEdges.get(0).symbol as Nonterminal).startState) val boxes: HashMap> = HashMap() for (state in states) { diff --git a/solver/src/main/kotlin/org/ucfs/sppf/SppfStorage.kt b/solver/src/main/kotlin/org/ucfs/sppf/SppfStorage.kt index 94194b664..2ef5b1212 100644 --- a/solver/src/main/kotlin/org/ucfs/sppf/SppfStorage.kt +++ b/solver/src/main/kotlin/org/ucfs/sppf/SppfStorage.kt @@ -1,5 +1,6 @@ package org.ucfs.sppf +import io.github.oshai.kotlinlogging.KotlinLogging import org.ucfs.rsm.RsmState import org.ucfs.rsm.symbol.ITerminal import org.ucfs.sppf.node.* @@ -8,6 +9,8 @@ import org.ucfs.sppf.node.* * @param InputEdgeType - type of vertex in input graph */ open class SppfStorage { + private val logger = KotlinLogging.logger {} + /** * Collection of created sppfNodes with access and search in O(1) time */ @@ -15,7 +18,10 @@ open class SppfStorage { private fun addNode(node: RangeSppfNode): RangeSppfNode { - return createdSppfNodes.getOrPut(node, { node }) + + val sppfNode = createdSppfNodes.getOrPut(node) { node } + logger.debug{"+sppf:${sppfNode.id}, "} + return sppfNode } /** @@ -37,7 +43,8 @@ open class SppfStorage { rsmState: RsmState ): RangeSppfNode { return addNode( - input, rsmRange, EpsilonNonterminalType(rsmState)) + input, rsmRange, EpsilonNonterminalType(rsmState) + ) } /** @@ -79,8 +86,8 @@ open class SppfStorage { if (!rangeNode.children.contains(valueNode)) { rangeNode.children.add(valueNode) } - for(child in children){ - if (!valueNode.children.contains(child)){ + for (child in children) { + if (!valueNode.children.contains(child)) { valueNode.children.add(child) } } diff --git a/solver/src/main/kotlin/org/ucfs/sppf/node/RangeSppfNode.kt b/solver/src/main/kotlin/org/ucfs/sppf/node/RangeSppfNode.kt index 93745a17a..fa68591d8 100644 --- a/solver/src/main/kotlin/org/ucfs/sppf/node/RangeSppfNode.kt +++ b/solver/src/main/kotlin/org/ucfs/sppf/node/RangeSppfNode.kt @@ -15,8 +15,6 @@ import org.ucfs.rsm.symbol.ITerminal * May be used as extended packed sppfNode. * @param VertexType - type of vertex in input graph */ -var lastId = 0 - data class RangeSppfNode( val inputRange: InputRange?, val rsmRange: RsmRange?, @@ -24,25 +22,44 @@ data class RangeSppfNode( ) { val id: Int = lastId++ val children = ArrayList>() + override fun toString(): String { + return when (type) { + is TerminalType<*> -> "Terminal `${type.terminal}` $inputRange" + is Range -> "Range $inputRange $rsmRange" + is NonterminalType -> "Nonterminal ${type.startState.nonterminal.name} $inputRange $rsmRange" + is IntermediateType<*> -> "Intermediate input:${type.inputPosition} rsm:${type.grammarSlot.id}" + is EpsilonNonterminalType -> "Epsilon ${type.startState.id}" + is EmptyType -> "Empty node" + else -> "Unknown sppf node type!" + } + } } -fun getEmptyRange(): RangeSppfNode = RangeSppfNode(null, null, EmptyType()) +fun getEmptyRange(): RangeSppfNode { + return RangeSppfNode(null, null, EmptyType()) +} data class InputRange( val from: VertexType, val to: VertexType, -) +) { + override fun toString(): String = "input:[$from;$to]" +} data class RsmRange( val from: RsmState, val to: RsmState, -) +) { + override fun toString(): String = "rsm:[${from.id};${to.id}]" +} interface RangeType -var lastEmptyId = 0 + object Range : RangeType data class TerminalType(val terminal: T) : RangeType data class NonterminalType(val startState: RsmState) : RangeType data class EpsilonNonterminalType(val startState: RsmState) : RangeType data class IntermediateType(val grammarSlot: RsmState, val inputPosition: VertexType) : RangeType -data class EmptyType(private val id: Int = lastEmptyId++) : RangeType +class EmptyType : RangeType + +var lastId = 0 diff --git a/solver/src/main/kotlin/org/ucfs/sppf/writeSppfToDot.kt b/solver/src/main/kotlin/org/ucfs/sppf/writeSppfToDot.kt index c45bc0ffe..a081cc3b5 100644 --- a/solver/src/main/kotlin/org/ucfs/sppf/writeSppfToDot.kt +++ b/solver/src/main/kotlin/org/ucfs/sppf/writeSppfToDot.kt @@ -4,6 +4,7 @@ import org.ucfs.sppf.node.* import java.nio.file.Files import java.nio.file.Path +val printWithId = false fun writeSppfToDot(sppfNode: RangeSppfNode, filePath: String, label: String = "") { val genPath = Path.of("gen", "sppf") Files.createDirectories(genPath) @@ -14,20 +15,34 @@ fun writeSppfToDot(sppfNode: RangeSppfNode, filePath: Str } } -fun getSppfDot(sppfNode: RangeSppfNode, label: String = ""): String { +fun getSppfDot(sppfNodes: Set>, label: String = ""): String { + val sb = StringBuilder() + sb.appendLine("digraph g {") + sb.appendLine("labelloc=\"t\"") + sb.appendLine("label=\"$label\"") + var idx = 0 + val results = sppfNodes.sortedWith(compareBy { it.toString() }).map { sppf -> getSppfDot(sppf.children[0], idx++.toString()) } + for (sppf in results.sorted()) { + sb.appendLine(sppf) + } + sb.appendLine("}") + return sb.toString() +} + +fun getSppfDot(sppfNode: RangeSppfNode, label: String): String { + val prefix = "_${label}_" val queue: ArrayDeque> = ArrayDeque(listOf(sppfNode)) val visited: HashSet = HashSet() var node: RangeSppfNode val sb = StringBuilder() - sb.appendLine("digraph g {") + sb.appendLine("subgraph cluster_$label{") sb.appendLine("labelloc=\"t\"") - sb.appendLine("label=\"$label\"") val nodeViews = HashMap, String>() while (queue.isNotEmpty()) { node = queue.removeFirst() if (!visited.add(node.hashCode())) continue - nodeViews[node] = getNodeView(node, ) + nodeViews[node] = getNodeView(node, node.id.toString()) node.children.forEach { queue.addLast(it) @@ -36,31 +51,26 @@ fun getSppfDot(sppfNode: RangeSppfNode, label: String = " val sortedViews = nodeViews.values.sorted() val nodeIds = HashMap, Int>() val nodeById = HashMap>() - for ((node, view) in nodeViews) { + for ((nodeInstance, view) in nodeViews) { val id = sortedViews.indexOf(view) - nodeIds[node] = id - nodeById[id] = node + nodeIds[nodeInstance] = id + nodeById[id] = nodeInstance } for (i in sortedViews.indices) { - sb.appendLine("$i ${sortedViews[i]}") + sb.appendLine("$prefix$i ${sortedViews[i]}") } for (i in nodeById.keys) { - val node = nodeById[i] - for(child in node!!.children) { - sb.appendLine("${nodeIds[node]}->${nodeIds[child]}") + val sortedNode = nodeById[i] + for (child in sortedNode!!.children) { + sb.appendLine("$prefix${nodeIds[sortedNode]}->$prefix${nodeIds[child]}") } - // if(node.children.size < 2){ - // continue - // } - // val cs = node.children.map({nodeIds[it]}).joinToString("->") - // sb.appendLine("{ rank = same; $cs [style=invis]}") + // TODO change format to force DOT to save children order } sb.appendLine("}") return sb.toString() - } @@ -70,63 +80,20 @@ enum class NodeShape(val view: String) { ) } -fun fillNodeTemplate( - id: String? = null, nodeInfo: String, inputRange: InputRange<*>?, shape: NodeShape, rsmRange: RsmRange? = null -): String { - val inputRangeView = if (inputRange != null) "input: [${inputRange.from}, ${inputRange.to}]" else null - val rsmRangeView = if (rsmRange != null) "rsm: [${rsmRange.from.id}, ${rsmRange.to.id}]" else null - val view = listOfNotNull(nodeInfo, inputRangeView, rsmRangeView).joinToString(", ") - return "[label = \"${id?: ""}${shape.name} $view\", shape = ${shape.view}]" +fun getNodeView(node: RangeSppfNode<*>, id: String): String { + val shape = getNodeShape(node.type) + val idView = if (printWithId) "$id " else "" + return "[label = \"$idView${node}\", shape = ${shape.view}]" } - -fun getNodeView(node: RangeSppfNode, id: String? = null): String { - val type = node.type - return when (type) { - is TerminalType<*> -> { - fillNodeTemplate( - id, "'${type.terminal}'", node.inputRange, NodeShape.Terminal - ) - } - - is NonterminalType -> { - fillNodeTemplate( - id, "${type.startState.nonterminal.name}", node.inputRange, NodeShape.Nonterminal - ) - } - - is IntermediateType<*> -> { - fillNodeTemplate( - id, "input: ${type.inputPosition}, rsm: ${type.grammarSlot.id}", node.inputRange, NodeShape.Intermediate - ) - } - - is EmptyType -> { - fillNodeTemplate( - id, "", null, NodeShape.Empty - ) - } - - is EpsilonNonterminalType -> { - fillNodeTemplate( - id, "RSM: ${type.startState.id}", node.inputRange, NodeShape.Epsilon - ) - } - - is RangeType -> { - fillNodeTemplate( - id, "", node.inputRange, NodeShape.Range, node.rsmRange - ) - } - - else -> throw IllegalStateException("Can't write node type $type to DOT") - +fun getNodeShape(rangeType: RangeType): NodeShape { + return when (rangeType) { + is TerminalType<*> -> NodeShape.Terminal + is NonterminalType -> NodeShape.Nonterminal + is IntermediateType<*> -> NodeShape.Intermediate + is EmptyType -> NodeShape.Empty + is EpsilonNonterminalType -> NodeShape.Epsilon + is Range -> NodeShape.Range + else -> throw IllegalStateException("Can't write node type $rangeType to DOT") } - - } - -private fun getView(range: RsmRange?): String { - if (range == null) return "" - return "rsm: [(${range.from.nonterminal.name}:${range.from.numId}), " + "(${range.to.nonterminal.name}:${range.to.numId})]" -} \ No newline at end of file diff --git a/test-shared/src/test/kotlin/grammars/SimpleDyck.kt b/test-shared/src/test/kotlin/grammars/SimpleDyck.kt index 8ff570101..7607036ec 100644 --- a/test-shared/src/test/kotlin/grammars/SimpleDyck.kt +++ b/test-shared/src/test/kotlin/grammars/SimpleDyck.kt @@ -1,6 +1,7 @@ package grammars import org.ucfs.grammar.combinator.Grammar +import org.ucfs.grammar.combinator.extension.StringExtension.or import org.ucfs.grammar.combinator.extension.StringExtension.times import org.ucfs.grammar.combinator.regexp.* import org.ucfs.grammar.combinator.regexp.Epsilon @@ -11,6 +12,16 @@ class SimplifiedDyck : Grammar() { init { S /= Option("(" * S * ")") + // S = ( S ) ? + } +} + +class StrangeDyck : Grammar() { + val S by Nt().asStart() + + init { + S /= "(" * S * ")" or "a" + // S = eps | ( S ) } } @@ -18,14 +29,15 @@ class LoopDyck : Grammar() { val S by Nt().asStart() init { - S /= Many( "(" * S * ")") + S /= Many("(" * S * ")") + // S = [ ( S ) ]* } } class ABGrammar : Grammar() { - val A by Nt(Term("a")) + val A by Nt(Term("a")) // A -> a val C by Nt(Term("a")) - val B by Nt(C) + val B by Nt(C) // C -> B val S by Nt(A or B).asStart() } @@ -36,4 +48,32 @@ class SALang : Grammar() { class Epsilon : Grammar() { val S by Nt(Epsilon).asStart() +} + +/** + * Can parse only one symbol 'a' + */ +class AmbiguousAStar1 : Grammar() { + val S by Nt().asStart() + + init { + S /= "a" or S + } +} + +class AmbiguousAStar2 : Grammar() { + val S by Nt().asStart() + + init { + S /= "a" or S * S + } +} + + +class AmbiguousAStar3 : Grammar() { + val S by Nt().asStart() + + init { + S /= "a" or S * S + } } \ No newline at end of file diff --git a/test-shared/src/test/kotlin/solver/AbstractCorrectnessTest.kt b/test-shared/src/test/kotlin/solver/AbstractCorrectnessTest.kt index 7eee2f4f8..685370823 100644 --- a/test-shared/src/test/kotlin/solver/AbstractCorrectnessTest.kt +++ b/test-shared/src/test/kotlin/solver/AbstractCorrectnessTest.kt @@ -7,14 +7,18 @@ import org.ucfs.grammar.combinator.Grammar import org.ucfs.rsm.writeRsmToDot import java.io.File import java.nio.file.Path +import kotlin.test.assertFalse abstract class AbstractCorrectnessTest { val rootPath: Path = Path.of("src", "test", "resources", "correctness") abstract fun getRootDataFolder(): Path - val grammars = listOf(SimplifiedDyck(), ABGrammar(), SALang(), Epsilon(), LoopDyck()) + val grammars = listOf(SimplifiedDyck(), ABGrammar(), SALang(), Epsilon(), LoopDyck(), AmbiguousAStar2(), AmbiguousAStar1()) + //TODO return only one result for ambiguous AmbiguousAStar2(), AmbiguousAStar1() + // TODO fix worst case for loopdyck val regenerate = false + //@TestFactory //TODO make it abstract by used grammar @Test @@ -34,6 +38,7 @@ abstract class AbstractCorrectnessTest { } } } + assertFalse { regenerate } } diff --git a/test-shared/src/test/kotlin/solver/TreeCorrectnessTest.kt b/test-shared/src/test/kotlin/solver/TreeCorrectnessTest.kt index 7f4fd1ded..8fbca8c48 100644 --- a/test-shared/src/test/kotlin/solver/TreeCorrectnessTest.kt +++ b/test-shared/src/test/kotlin/solver/TreeCorrectnessTest.kt @@ -25,7 +25,11 @@ class TreeCorrectnessTest : AbstractCorrectnessTest() { if (expectedResult.isEmpty() || regenerate) { expectedFile.writeText(actualResult) } else { - assertEquals(expectedResult, actualResult) + assertEquals( + expectedResult, + actualResult, + "for grammar ${grammar.javaClass.simpleName} at ${testCasesFolder.name}" + ) } } diff --git a/test-shared/src/test/resources/correctness/tree/ABGrammar/ambig/result.dot b/test-shared/src/test/resources/correctness/tree/ABGrammar/ambig/result.dot index 1d27629f1..c085c9915 100644 --- a/test-shared/src/test/resources/correctness/tree/ABGrammar/ambig/result.dot +++ b/test-shared/src/test/resources/correctness/tree/ABGrammar/ambig/result.dot @@ -1,20 +1,28 @@ digraph g { labelloc="t" label="" -0 [label = "Nonterminal A, input: [0, 1]", shape = invtrapezium] -1 [label = "Nonterminal B, input: [0, 1]", shape = invtrapezium] -2 [label = "Nonterminal C, input: [0, 1]", shape = invtrapezium] -3 [label = "Range , input: [0, 1], rsm: [A_0, A_1]", shape = ellipse] -4 [label = "Range , input: [0, 1], rsm: [B_0, B_1]", shape = ellipse] -5 [label = "Range , input: [0, 1], rsm: [C_0, C_1]", shape = ellipse] -6 [label = "Range , input: [0, 1], rsm: [S_0, S_1]", shape = ellipse] -7 [label = "Terminal 'a', input: [0, 1]", shape = rectangle] -0->3 -1->4 -2->5 -3->7 -4->2 -5->7 -6->1 -6->0 +subgraph cluster_0{ +labelloc="t" +0_0 [label = "26Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_1 [label = "27Terminal TerminalType(terminal=a)", shape = rectangle] +0_2 [label = "28Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_3 [label = "29Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(C), isStart=true, isFinal=false, numId=0))", shape = invtrapezium] +0_4 [label = "30Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_5 [label = "31Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(B), isStart=true, isFinal=false, numId=0))", shape = invtrapezium] +0_6 [label = "32Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_7 [label = "33Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=false, numId=0))", shape = invtrapezium] +0_8 [label = "34Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_9 [label = "37Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(A), isStart=true, isFinal=false, numId=0))", shape = invtrapezium] +0_0->0_1 +0_2->0_3 +0_3->0_0 +0_4->0_5 +0_4->0_9 +0_5->0_2 +0_6->0_7 +0_7->0_4 +0_8->0_1 +0_9->0_8 +} + } diff --git a/test-shared/src/test/resources/correctness/tree/AmbiguousAStar1/simple/input.dot b/test-shared/src/test/resources/correctness/tree/AmbiguousAStar1/simple/input.dot new file mode 100644 index 000000000..2ff53cdf3 --- /dev/null +++ b/test-shared/src/test/resources/correctness/tree/AmbiguousAStar1/simple/input.dot @@ -0,0 +1,6 @@ +digraph Input { + start -> 0; + 0 -> 1 [label = "a"]; + 1 -> 2 [label = "a"]; + 2 -> 3 [label = "a"]; +} \ No newline at end of file diff --git a/test-shared/src/test/resources/correctness/tree/AmbiguousAStar1/simple/result.dot b/test-shared/src/test/resources/correctness/tree/AmbiguousAStar1/simple/result.dot new file mode 100644 index 000000000..5432708a8 --- /dev/null +++ b/test-shared/src/test/resources/correctness/tree/AmbiguousAStar1/simple/result.dot @@ -0,0 +1,11 @@ +digraph g { +labelloc="t" +label="" +0 [label = "Nonterminal S, input: [0, 1]", shape = invtrapezium] +1 [label = "Nonterminal S, input: [0, 1]", shape = invtrapezium] +2 [label = "Range , input: [0, 1], rsm: [S_0, S_1]", shape = ellipse] +3 [label = "Terminal 'a', input: [0, 1]", shape = rectangle] +0->2 +2->3 +2->0 +} diff --git a/test-shared/src/test/resources/correctness/tree/AmbiguousAStar2/simple/input.dot b/test-shared/src/test/resources/correctness/tree/AmbiguousAStar2/simple/input.dot new file mode 100644 index 000000000..2ff53cdf3 --- /dev/null +++ b/test-shared/src/test/resources/correctness/tree/AmbiguousAStar2/simple/input.dot @@ -0,0 +1,6 @@ +digraph Input { + start -> 0; + 0 -> 1 [label = "a"]; + 1 -> 2 [label = "a"]; + 2 -> 3 [label = "a"]; +} \ No newline at end of file diff --git a/test-shared/src/test/resources/correctness/tree/AmbiguousAStar2/simple/result.dot b/test-shared/src/test/resources/correctness/tree/AmbiguousAStar2/simple/result.dot new file mode 100644 index 000000000..50e0726a4 --- /dev/null +++ b/test-shared/src/test/resources/correctness/tree/AmbiguousAStar2/simple/result.dot @@ -0,0 +1,57 @@ +digraph g { +labelloc="t" +label="" +0 [label = "Intermediate input: 1, rsm: S_2, input: [0, 2]", shape = plain] +1 [label = "Intermediate input: 1, rsm: S_2, input: [0, 3]", shape = plain] +2 [label = "Intermediate input: 2, rsm: S_2, input: [0, 3]", shape = plain] +3 [label = "Intermediate input: 2, rsm: S_2, input: [1, 3]", shape = plain] +4 [label = "Nonterminal S, input: [0, 1]", shape = invtrapezium] +5 [label = "Nonterminal S, input: [0, 2]", shape = invtrapezium] +6 [label = "Nonterminal S, input: [0, 3]", shape = invtrapezium] +7 [label = "Nonterminal S, input: [1, 2]", shape = invtrapezium] +8 [label = "Nonterminal S, input: [1, 2]", shape = invtrapezium] +9 [label = "Nonterminal S, input: [1, 3]", shape = invtrapezium] +10 [label = "Nonterminal S, input: [2, 3]", shape = invtrapezium] +11 [label = "Range , input: [0, 1], rsm: [S_0, S_1]", shape = ellipse] +12 [label = "Range , input: [0, 1], rsm: [S_0, S_2]", shape = ellipse] +13 [label = "Range , input: [0, 2], rsm: [S_0, S_1]", shape = ellipse] +14 [label = "Range , input: [0, 2], rsm: [S_0, S_2]", shape = ellipse] +15 [label = "Range , input: [0, 3], rsm: [S_0, S_1]", shape = ellipse] +16 [label = "Range , input: [1, 2], rsm: [S_0, S_1]", shape = ellipse] +17 [label = "Range , input: [1, 2], rsm: [S_0, S_2]", shape = ellipse] +18 [label = "Range , input: [1, 2], rsm: [S_2, S_1]", shape = ellipse] +19 [label = "Range , input: [1, 3], rsm: [S_0, S_1]", shape = ellipse] +20 [label = "Range , input: [1, 3], rsm: [S_2, S_1]", shape = ellipse] +21 [label = "Range , input: [2, 3], rsm: [S_0, S_1]", shape = ellipse] +22 [label = "Range , input: [2, 3], rsm: [S_2, S_1]", shape = ellipse] +23 [label = "Terminal 'a', input: [0, 1]", shape = rectangle] +24 [label = "Terminal 'a', input: [1, 2]", shape = rectangle] +25 [label = "Terminal 'a', input: [2, 3]", shape = rectangle] +0->12 +0->18 +1->12 +1->20 +2->14 +2->22 +3->17 +3->22 +4->11 +5->13 +6->15 +7->16 +9->19 +10->21 +11->23 +12->4 +13->0 +14->5 +15->1 +15->2 +16->24 +17->7 +18->7 +19->3 +20->9 +21->25 +22->10 +} diff --git a/test-shared/src/test/resources/correctness/tree/AmbiguousAStar3/simple/input.dot b/test-shared/src/test/resources/correctness/tree/AmbiguousAStar3/simple/input.dot new file mode 100644 index 000000000..2ff53cdf3 --- /dev/null +++ b/test-shared/src/test/resources/correctness/tree/AmbiguousAStar3/simple/input.dot @@ -0,0 +1,6 @@ +digraph Input { + start -> 0; + 0 -> 1 [label = "a"]; + 1 -> 2 [label = "a"]; + 2 -> 3 [label = "a"]; +} \ No newline at end of file diff --git a/test-shared/src/test/resources/correctness/tree/AmbiguousAStar3/simple/result.dot b/test-shared/src/test/resources/correctness/tree/AmbiguousAStar3/simple/result.dot new file mode 100644 index 000000000..368e3ef3e --- /dev/null +++ b/test-shared/src/test/resources/correctness/tree/AmbiguousAStar3/simple/result.dot @@ -0,0 +1,10 @@ +digraph g { +labelloc="t" +label="" +0 [label = "Nonterminal S, input: [0, 1]", shape = invtrapezium] +1 [label = "Range , input: [0, 1], rsm: [S_0, S_1]", shape = ellipse] +2 [label = "Terminal 'a', input: [0, 1]", shape = rectangle] +0->1 +1->2 +1->0 +} diff --git a/test-shared/src/test/resources/correctness/tree/Epsilon/epsilon/result.dot b/test-shared/src/test/resources/correctness/tree/Epsilon/epsilon/result.dot index b7962fa25..1291137c4 100644 --- a/test-shared/src/test/resources/correctness/tree/Epsilon/epsilon/result.dot +++ b/test-shared/src/test/resources/correctness/tree/Epsilon/epsilon/result.dot @@ -1,7 +1,15 @@ digraph g { labelloc="t" label="" -0 [label = "Epsilon RSM: S_0, input: [0, 0]", shape = invhouse] -1 [label = "Range , input: [0, 0], rsm: [S_0, S_0]", shape = ellipse] -1->0 +subgraph cluster_0{ +labelloc="t" +0_0 [label = "63Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_1 [label = "64Epsilon EpsilonNonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invhouse] +0_2 [label = "65Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_3 [label = "66Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invtrapezium] +0_0->0_1 +0_2->0_3 +0_3->0_0 +} + } diff --git a/test-shared/src/test/resources/correctness/tree/LoopDyck/minimalWorstCase/result.dot b/test-shared/src/test/resources/correctness/tree/LoopDyck/minimalWorstCase/result.dot index 8e702aee9..dd4387426 100644 --- a/test-shared/src/test/resources/correctness/tree/LoopDyck/minimalWorstCase/result.dot +++ b/test-shared/src/test/resources/correctness/tree/LoopDyck/minimalWorstCase/result.dot @@ -1,43 +1,98 @@ digraph g { labelloc="t" label="" -0 [label = "Epsilon RSM: S_0, input: [0, 0]", shape = invhouse] -1 [label = "Intermediate input: 0, rsm: S_1, input: [0, 0]", shape = plain] -2 [label = "Intermediate input: 0, rsm: S_1, input: [0, 1]", shape = plain] -3 [label = "Intermediate input: 0, rsm: S_2, input: [0, 1]", shape = plain] -4 [label = "Intermediate input: 1, rsm: S_2, input: [0, 0]", shape = plain] -5 [label = "Nonterminal S, input: [0, 0]", shape = invtrapezium] -6 [label = "Nonterminal S, input: [0, 1]", shape = invtrapezium] -7 [label = "Range , input: [0, 0], rsm: [S_0, S_0]", shape = ellipse] -8 [label = "Range , input: [0, 0], rsm: [S_0, S_1]", shape = ellipse] -9 [label = "Range , input: [0, 0], rsm: [S_0, S_2]", shape = ellipse] -10 [label = "Range , input: [0, 0], rsm: [S_1, S_2]", shape = ellipse] -11 [label = "Range , input: [0, 1], rsm: [S_0, S_0]", shape = ellipse] -12 [label = "Range , input: [0, 1], rsm: [S_0, S_2]", shape = ellipse] -13 [label = "Range , input: [0, 1], rsm: [S_1, S_2]", shape = ellipse] -14 [label = "Range , input: [0, 1], rsm: [S_2, S_0]", shape = ellipse] -15 [label = "Range , input: [1, 0], rsm: [S_2, S_0]", shape = ellipse] -16 [label = "Terminal '(', input: [0, 0]", shape = rectangle] -17 [label = "Terminal ')', input: [0, 1]", shape = rectangle] -18 [label = "Terminal ')', input: [1, 0]", shape = rectangle] -1->8 -1->10 -2->8 -2->13 -3->9 -3->14 -4->12 -4->15 -5->7 -6->11 -7->0 -7->4 -8->16 -9->1 -10->5 -11->3 -12->2 -13->6 -14->17 -15->18 +subgraph cluster_0{ +labelloc="t" +0_0 [label = "107Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_1 [label = "108Epsilon EpsilonNonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invhouse] +0_2 [label = "111Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_3 [label = "112Terminal TerminalType(terminal=()", shape = rectangle] +0_4 [label = "114Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_5 [label = "115Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invtrapezium] +0_6 [label = "116Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_7 [label = "117Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=1), inputPosition=0)", shape = plain] +0_8 [label = "118Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_9 [label = "119Terminal TerminalType(terminal=))", shape = rectangle] +0_10 [label = "120Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_11 [label = "121Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=2), inputPosition=0)", shape = plain] +0_12 [label = "122Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_13 [label = "123Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invtrapezium] +0_14 [label = "124Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_15 [label = "125Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invtrapezium] +0_16 [label = "126Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_17 [label = "127Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=1), inputPosition=0)", shape = plain] +0_18 [label = "128Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_19 [label = "129Terminal TerminalType(terminal=))", shape = rectangle] +0_20 [label = "131Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=2), inputPosition=1)", shape = plain] +0_0->0_1 +0_0->0_20 +0_2->0_3 +0_4->0_5 +0_5->0_0 +0_6->0_7 +0_7->0_2 +0_7->0_4 +0_8->0_9 +0_10->0_11 +0_11->0_6 +0_11->0_8 +0_12->0_13 +0_13->0_10 +0_14->0_15 +0_15->0_10 +0_16->0_17 +0_17->0_2 +0_17->0_14 +0_18->0_19 +0_20->0_16 +0_20->0_18 +} + +subgraph cluster_1{ +labelloc="t" +1_0 [label = "107Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +1_1 [label = "108Epsilon EpsilonNonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invhouse] +1_2 [label = "109Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +1_3 [label = "110Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invtrapezium] +1_4 [label = "111Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +1_5 [label = "112Terminal TerminalType(terminal=()", shape = rectangle] +1_6 [label = "114Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +1_7 [label = "115Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invtrapezium] +1_8 [label = "116Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +1_9 [label = "117Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=1), inputPosition=0)", shape = plain] +1_10 [label = "118Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +1_11 [label = "119Terminal TerminalType(terminal=))", shape = rectangle] +1_12 [label = "120Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +1_13 [label = "121Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=2), inputPosition=0)", shape = plain] +1_14 [label = "124Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +1_15 [label = "125Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invtrapezium] +1_16 [label = "126Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +1_17 [label = "127Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=1), inputPosition=0)", shape = plain] +1_18 [label = "128Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +1_19 [label = "129Terminal TerminalType(terminal=))", shape = rectangle] +1_20 [label = "131Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=2), inputPosition=1)", shape = plain] +1_0->1_1 +1_0->1_20 +1_2->1_3 +1_3->1_0 +1_4->1_5 +1_6->1_7 +1_7->1_0 +1_8->1_9 +1_9->1_4 +1_9->1_6 +1_10->1_11 +1_12->1_13 +1_13->1_8 +1_13->1_10 +1_14->1_15 +1_15->1_12 +1_16->1_17 +1_17->1_4 +1_17->1_14 +1_18->1_19 +1_20->1_16 +1_20->1_18 +} + } diff --git a/test-shared/src/test/resources/correctness/tree/LoopDyck/oneVertex/result.dot b/test-shared/src/test/resources/correctness/tree/LoopDyck/oneVertex/result.dot index 2f93dc957..f33564e76 100644 --- a/test-shared/src/test/resources/correctness/tree/LoopDyck/oneVertex/result.dot +++ b/test-shared/src/test/resources/correctness/tree/LoopDyck/oneVertex/result.dot @@ -1,26 +1,34 @@ digraph g { labelloc="t" label="" -0 [label = "Epsilon RSM: S_0, input: [0, 0]", shape = invhouse] -1 [label = "Intermediate input: 0, rsm: S_1, input: [0, 0]", shape = plain] -2 [label = "Intermediate input: 0, rsm: S_2, input: [0, 0]", shape = plain] -3 [label = "Nonterminal S, input: [0, 0]", shape = invtrapezium] -4 [label = "Range , input: [0, 0], rsm: [S_0, S_0]", shape = ellipse] -5 [label = "Range , input: [0, 0], rsm: [S_0, S_1]", shape = ellipse] -6 [label = "Range , input: [0, 0], rsm: [S_0, S_2]", shape = ellipse] -7 [label = "Range , input: [0, 0], rsm: [S_1, S_2]", shape = ellipse] -8 [label = "Range , input: [0, 0], rsm: [S_2, S_0]", shape = ellipse] -9 [label = "Terminal '(', input: [0, 0]", shape = rectangle] -10 [label = "Terminal ')', input: [0, 0]", shape = rectangle] -1->5 -1->7 -2->6 -2->8 -3->4 -4->0 -4->2 -5->9 -6->1 -7->3 -8->10 +subgraph cluster_0{ +labelloc="t" +0_0 [label = "144Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_1 [label = "145Epsilon EpsilonNonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invhouse] +0_2 [label = "146Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_3 [label = "147Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invtrapezium] +0_4 [label = "148Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_5 [label = "149Terminal TerminalType(terminal=()", shape = rectangle] +0_6 [label = "151Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_7 [label = "152Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invtrapezium] +0_8 [label = "153Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_9 [label = "154Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=1), inputPosition=0)", shape = plain] +0_10 [label = "155Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_11 [label = "156Terminal TerminalType(terminal=))", shape = rectangle] +0_12 [label = "158Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=2), inputPosition=0)", shape = plain] +0_0->0_1 +0_0->0_12 +0_2->0_3 +0_3->0_0 +0_4->0_5 +0_6->0_7 +0_7->0_0 +0_8->0_9 +0_9->0_4 +0_9->0_6 +0_10->0_11 +0_12->0_8 +0_12->0_10 +} + } diff --git a/test-shared/src/test/resources/correctness/tree/LoopDyck/secondWorstCase/result.dot b/test-shared/src/test/resources/correctness/tree/LoopDyck/secondWorstCase/result.dot index 130fa1bc3..280b9f907 100644 --- a/test-shared/src/test/resources/correctness/tree/LoopDyck/secondWorstCase/result.dot +++ b/test-shared/src/test/resources/correctness/tree/LoopDyck/secondWorstCase/result.dot @@ -1,122 +1,382 @@ digraph g { labelloc="t" label="" -0 [label = "Epsilon RSM: S_0, input: [0, 0]", shape = invhouse] -1 [label = "Intermediate input: 0, rsm: S_0, input: [3, 3]", shape = plain] -2 [label = "Intermediate input: 0, rsm: S_1, input: [3, 0]", shape = plain] -3 [label = "Intermediate input: 0, rsm: S_1, input: [3, 1]", shape = plain] -4 [label = "Intermediate input: 0, rsm: S_1, input: [3, 2]", shape = plain] -5 [label = "Intermediate input: 0, rsm: S_2, input: [0, 1]", shape = plain] -6 [label = "Intermediate input: 0, rsm: S_2, input: [3, 1]", shape = plain] -7 [label = "Intermediate input: 1, rsm: S_2, input: [0, 2]", shape = plain] -8 [label = "Intermediate input: 1, rsm: S_2, input: [3, 2]", shape = plain] -9 [label = "Intermediate input: 2, rsm: S_2, input: [0, 0]", shape = plain] -10 [label = "Intermediate input: 2, rsm: S_2, input: [3, 0]", shape = plain] -11 [label = "Intermediate input: 3, rsm: S_1, input: [0, 0]", shape = plain] -12 [label = "Intermediate input: 3, rsm: S_1, input: [0, 1]", shape = plain] -13 [label = "Intermediate input: 3, rsm: S_1, input: [0, 2]", shape = plain] -14 [label = "Intermediate input: 3, rsm: S_1, input: [3, 0]", shape = plain] -15 [label = "Intermediate input: 3, rsm: S_1, input: [3, 1]", shape = plain] -16 [label = "Intermediate input: 3, rsm: S_1, input: [3, 2]", shape = plain] -17 [label = "Nonterminal S, input: [0, 0]", shape = invtrapezium] -18 [label = "Nonterminal S, input: [0, 1]", shape = invtrapezium] -19 [label = "Nonterminal S, input: [0, 2]", shape = invtrapezium] -20 [label = "Nonterminal S, input: [3, 0]", shape = invtrapezium] -21 [label = "Nonterminal S, input: [3, 1]", shape = invtrapezium] -22 [label = "Nonterminal S, input: [3, 2]", shape = invtrapezium] -23 [label = "Range , input: [0, 0], rsm: [S_0, S_0]", shape = ellipse] -24 [label = "Range , input: [0, 0], rsm: [S_0, S_2]", shape = ellipse] -25 [label = "Range , input: [0, 0], rsm: [S_1, S_2]", shape = ellipse] -26 [label = "Range , input: [0, 1], rsm: [S_0, S_0]", shape = ellipse] -27 [label = "Range , input: [0, 1], rsm: [S_0, S_2]", shape = ellipse] -28 [label = "Range , input: [0, 1], rsm: [S_1, S_2]", shape = ellipse] -29 [label = "Range , input: [0, 1], rsm: [S_2, S_0]", shape = ellipse] -30 [label = "Range , input: [0, 2], rsm: [S_0, S_0]", shape = ellipse] -31 [label = "Range , input: [0, 2], rsm: [S_0, S_2]", shape = ellipse] -32 [label = "Range , input: [0, 2], rsm: [S_1, S_2]", shape = ellipse] -33 [label = "Range , input: [0, 3], rsm: [S_0, S_1]", shape = ellipse] -34 [label = "Range , input: [1, 2], rsm: [S_2, S_0]", shape = ellipse] -35 [label = "Range , input: [2, 0], rsm: [S_2, S_0]", shape = ellipse] -36 [label = "Range , input: [3, 0], rsm: [S_0, S_0]", shape = ellipse] -37 [label = "Range , input: [3, 0], rsm: [S_0, S_1]", shape = ellipse] -38 [label = "Range , input: [3, 0], rsm: [S_0, S_2]", shape = ellipse] -39 [label = "Range , input: [3, 0], rsm: [S_1, S_2]", shape = ellipse] -40 [label = "Range , input: [3, 1], rsm: [S_0, S_0]", shape = ellipse] -41 [label = "Range , input: [3, 1], rsm: [S_0, S_2]", shape = ellipse] -42 [label = "Range , input: [3, 1], rsm: [S_1, S_2]", shape = ellipse] -43 [label = "Range , input: [3, 2], rsm: [S_0, S_0]", shape = ellipse] -44 [label = "Range , input: [3, 2], rsm: [S_0, S_2]", shape = ellipse] -45 [label = "Range , input: [3, 2], rsm: [S_1, S_2]", shape = ellipse] -46 [label = "Range , input: [3, 3], rsm: [S_0, S_1]", shape = ellipse] -47 [label = "Terminal '(', input: [0, 3]", shape = rectangle] -48 [label = "Terminal '(', input: [3, 0]", shape = rectangle] -49 [label = "Terminal ')', input: [0, 1]", shape = rectangle] -50 [label = "Terminal ')', input: [1, 2]", shape = rectangle] -51 [label = "Terminal ')', input: [2, 0]", shape = rectangle] -1->36 -1->33 -2->37 -2->25 -3->37 -3->28 -4->37 -4->32 -5->24 -5->29 -6->38 -6->29 -7->27 -7->34 -8->41 -8->34 -9->31 -9->35 -10->44 -10->35 -11->33 -11->39 -12->33 -12->42 -13->33 -13->45 -14->46 -14->39 -15->46 -15->42 -16->46 -16->45 -17->23 -18->26 -19->30 -20->36 -21->40 -22->43 -23->0 -23->9 -24->11 -25->17 -26->5 -27->12 -28->18 -29->49 -30->7 -31->13 -32->19 -33->47 -34->50 -35->51 -36->10 -37->48 -38->2 -38->14 -39->20 -40->6 -41->15 -41->3 -42->21 -43->8 -44->4 -44->16 -45->22 -46->1 +subgraph cluster_0{ +labelloc="t" +0_0 [label = "171Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_1 [label = "172Epsilon EpsilonNonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invhouse] +0_2 [label = "175Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_3 [label = "176Terminal TerminalType(terminal=()", shape = rectangle] +0_4 [label = "184Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_5 [label = "185Terminal TerminalType(terminal=()", shape = rectangle] +0_6 [label = "187Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_7 [label = "188Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invtrapezium] +0_8 [label = "189Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_9 [label = "190Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=1), inputPosition=0)", shape = plain] +0_10 [label = "191Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_11 [label = "192Terminal TerminalType(terminal=))", shape = rectangle] +0_12 [label = "193Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_13 [label = "194Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=2), inputPosition=0)", shape = plain] +0_14 [label = "195Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_15 [label = "196Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invtrapezium] +0_16 [label = "197Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_17 [label = "198Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=1), inputPosition=3)", shape = plain] +0_18 [label = "199Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_19 [label = "200Terminal TerminalType(terminal=))", shape = rectangle] +0_20 [label = "201Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_21 [label = "202Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=2), inputPosition=1)", shape = plain] +0_22 [label = "205Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_23 [label = "206Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invtrapezium] +0_24 [label = "207Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_25 [label = "208Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=1), inputPosition=0)", shape = plain] +0_26 [label = "209Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_27 [label = "210Terminal TerminalType(terminal=))", shape = rectangle] +0_28 [label = "211Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_29 [label = "212Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=2), inputPosition=2)", shape = plain] +0_30 [label = "213Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_31 [label = "214Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invtrapezium] +0_32 [label = "215Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_33 [label = "216Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=1), inputPosition=3)", shape = plain] +0_34 [label = "219Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_35 [label = "220Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0), inputPosition=0)", shape = plain] +0_36 [label = "228Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_37 [label = "229Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=1), inputPosition=3)", shape = plain] +0_38 [label = "233Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=1), inputPosition=3)", shape = plain] +0_39 [label = "236Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_40 [label = "237Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=2), inputPosition=1)", shape = plain] +0_41 [label = "238Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_42 [label = "239Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invtrapezium] +0_43 [label = "240Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_44 [label = "241Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=1), inputPosition=3)", shape = plain] +0_45 [label = "245Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=1), inputPosition=3)", shape = plain] +0_46 [label = "249Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=2), inputPosition=2)", shape = plain] +0_47 [label = "264Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_48 [label = "265Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=2), inputPosition=0)", shape = plain] +0_49 [label = "266Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_50 [label = "267Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invtrapezium] +0_51 [label = "268Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_52 [label = "269Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invtrapezium] +0_53 [label = "271Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=1), inputPosition=0)", shape = plain] +0_0->0_1 +0_0->0_46 +0_2->0_3 +0_4->0_5 +0_6->0_7 +0_7->0_0 +0_8->0_9 +0_8->0_38 +0_9->0_4 +0_9->0_6 +0_10->0_11 +0_12->0_13 +0_13->0_8 +0_13->0_10 +0_14->0_15 +0_15->0_12 +0_16->0_17 +0_17->0_2 +0_17->0_14 +0_18->0_19 +0_20->0_21 +0_21->0_16 +0_21->0_18 +0_22->0_23 +0_23->0_20 +0_24->0_25 +0_24->0_45 +0_25->0_4 +0_25->0_22 +0_26->0_27 +0_28->0_29 +0_29->0_24 +0_29->0_26 +0_30->0_31 +0_31->0_28 +0_32->0_33 +0_33->0_2 +0_33->0_30 +0_34->0_35 +0_35->0_28 +0_35->0_2 +0_36->0_37 +0_36->0_53 +0_37->0_34 +0_37->0_14 +0_38->0_34 +0_38->0_30 +0_39->0_40 +0_40->0_36 +0_40->0_18 +0_41->0_42 +0_42->0_39 +0_43->0_44 +0_44->0_2 +0_44->0_41 +0_45->0_34 +0_45->0_41 +0_46->0_43 +0_46->0_26 +0_47->0_48 +0_48->0_32 +0_48->0_10 +0_49->0_50 +0_50->0_47 +0_51->0_52 +0_52->0_47 +0_53->0_4 +0_53->0_51 +} + +subgraph cluster_1{ +labelloc="t" +1_0 [label = "171Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +1_1 [label = "172Epsilon EpsilonNonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invhouse] +1_2 [label = "175Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +1_3 [label = "176Terminal TerminalType(terminal=()", shape = rectangle] +1_4 [label = "184Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +1_5 [label = "185Terminal TerminalType(terminal=()", shape = rectangle] +1_6 [label = "187Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +1_7 [label = "188Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invtrapezium] +1_8 [label = "189Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +1_9 [label = "190Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=1), inputPosition=0)", shape = plain] +1_10 [label = "191Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +1_11 [label = "192Terminal TerminalType(terminal=))", shape = rectangle] +1_12 [label = "193Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +1_13 [label = "194Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=2), inputPosition=0)", shape = plain] +1_14 [label = "195Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +1_15 [label = "196Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invtrapezium] +1_16 [label = "197Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +1_17 [label = "198Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=1), inputPosition=3)", shape = plain] +1_18 [label = "199Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +1_19 [label = "200Terminal TerminalType(terminal=))", shape = rectangle] +1_20 [label = "201Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +1_21 [label = "202Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=2), inputPosition=1)", shape = plain] +1_22 [label = "203Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +1_23 [label = "204Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invtrapezium] +1_24 [label = "205Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +1_25 [label = "206Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invtrapezium] +1_26 [label = "207Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +1_27 [label = "208Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=1), inputPosition=0)", shape = plain] +1_28 [label = "209Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +1_29 [label = "210Terminal TerminalType(terminal=))", shape = rectangle] +1_30 [label = "211Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +1_31 [label = "212Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=2), inputPosition=2)", shape = plain] +1_32 [label = "213Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +1_33 [label = "214Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invtrapezium] +1_34 [label = "215Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +1_35 [label = "216Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=1), inputPosition=3)", shape = plain] +1_36 [label = "219Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +1_37 [label = "220Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0), inputPosition=0)", shape = plain] +1_38 [label = "228Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +1_39 [label = "229Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=1), inputPosition=3)", shape = plain] +1_40 [label = "233Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=1), inputPosition=3)", shape = plain] +1_41 [label = "236Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +1_42 [label = "237Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=2), inputPosition=1)", shape = plain] +1_43 [label = "238Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +1_44 [label = "239Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invtrapezium] +1_45 [label = "240Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +1_46 [label = "241Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=1), inputPosition=3)", shape = plain] +1_47 [label = "245Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=1), inputPosition=3)", shape = plain] +1_48 [label = "249Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=2), inputPosition=2)", shape = plain] +1_49 [label = "264Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +1_50 [label = "265Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=2), inputPosition=0)", shape = plain] +1_51 [label = "268Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +1_52 [label = "269Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invtrapezium] +1_53 [label = "271Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=1), inputPosition=0)", shape = plain] +1_0->1_1 +1_0->1_48 +1_2->1_3 +1_4->1_5 +1_6->1_7 +1_7->1_0 +1_8->1_9 +1_8->1_40 +1_9->1_4 +1_9->1_6 +1_10->1_11 +1_12->1_13 +1_13->1_8 +1_13->1_10 +1_14->1_15 +1_15->1_12 +1_16->1_17 +1_17->1_2 +1_17->1_14 +1_18->1_19 +1_20->1_21 +1_21->1_16 +1_21->1_18 +1_22->1_23 +1_23->1_20 +1_24->1_25 +1_25->1_20 +1_26->1_27 +1_26->1_47 +1_27->1_4 +1_27->1_24 +1_28->1_29 +1_30->1_31 +1_31->1_26 +1_31->1_28 +1_32->1_33 +1_33->1_30 +1_34->1_35 +1_35->1_2 +1_35->1_32 +1_36->1_37 +1_37->1_30 +1_37->1_2 +1_38->1_39 +1_38->1_53 +1_39->1_36 +1_39->1_14 +1_40->1_36 +1_40->1_32 +1_41->1_42 +1_42->1_38 +1_42->1_18 +1_43->1_44 +1_44->1_41 +1_45->1_46 +1_46->1_2 +1_46->1_43 +1_47->1_36 +1_47->1_43 +1_48->1_45 +1_48->1_28 +1_49->1_50 +1_50->1_34 +1_50->1_10 +1_51->1_52 +1_52->1_49 +1_53->1_4 +1_53->1_51 +} + +subgraph cluster_2{ +labelloc="t" +2_0 [label = "171Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_1 [label = "172Epsilon EpsilonNonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invhouse] +2_2 [label = "173Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_3 [label = "174Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invtrapezium] +2_4 [label = "175Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_5 [label = "176Terminal TerminalType(terminal=()", shape = rectangle] +2_6 [label = "184Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_7 [label = "185Terminal TerminalType(terminal=()", shape = rectangle] +2_8 [label = "187Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_9 [label = "188Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invtrapezium] +2_10 [label = "189Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_11 [label = "190Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=1), inputPosition=0)", shape = plain] +2_12 [label = "191Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_13 [label = "192Terminal TerminalType(terminal=))", shape = rectangle] +2_14 [label = "193Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_15 [label = "194Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=2), inputPosition=0)", shape = plain] +2_16 [label = "195Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_17 [label = "196Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invtrapezium] +2_18 [label = "197Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_19 [label = "198Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=1), inputPosition=3)", shape = plain] +2_20 [label = "199Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_21 [label = "200Terminal TerminalType(terminal=))", shape = rectangle] +2_22 [label = "201Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_23 [label = "202Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=2), inputPosition=1)", shape = plain] +2_24 [label = "205Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_25 [label = "206Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invtrapezium] +2_26 [label = "207Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_27 [label = "208Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=1), inputPosition=0)", shape = plain] +2_28 [label = "209Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_29 [label = "210Terminal TerminalType(terminal=))", shape = rectangle] +2_30 [label = "211Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_31 [label = "212Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=2), inputPosition=2)", shape = plain] +2_32 [label = "213Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_33 [label = "214Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invtrapezium] +2_34 [label = "215Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_35 [label = "216Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=1), inputPosition=3)", shape = plain] +2_36 [label = "219Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_37 [label = "220Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0), inputPosition=0)", shape = plain] +2_38 [label = "228Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_39 [label = "229Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=1), inputPosition=3)", shape = plain] +2_40 [label = "233Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=1), inputPosition=3)", shape = plain] +2_41 [label = "236Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_42 [label = "237Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=2), inputPosition=1)", shape = plain] +2_43 [label = "238Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_44 [label = "239Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invtrapezium] +2_45 [label = "240Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_46 [label = "241Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=1), inputPosition=3)", shape = plain] +2_47 [label = "245Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=1), inputPosition=3)", shape = plain] +2_48 [label = "249Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=2), inputPosition=2)", shape = plain] +2_49 [label = "264Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_50 [label = "265Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=2), inputPosition=0)", shape = plain] +2_51 [label = "268Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_52 [label = "269Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invtrapezium] +2_53 [label = "271Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=1), inputPosition=0)", shape = plain] +2_0->2_1 +2_0->2_48 +2_2->2_3 +2_3->2_0 +2_4->2_5 +2_6->2_7 +2_8->2_9 +2_9->2_0 +2_10->2_11 +2_10->2_40 +2_11->2_6 +2_11->2_8 +2_12->2_13 +2_14->2_15 +2_15->2_10 +2_15->2_12 +2_16->2_17 +2_17->2_14 +2_18->2_19 +2_19->2_4 +2_19->2_16 +2_20->2_21 +2_22->2_23 +2_23->2_18 +2_23->2_20 +2_24->2_25 +2_25->2_22 +2_26->2_27 +2_26->2_47 +2_27->2_6 +2_27->2_24 +2_28->2_29 +2_30->2_31 +2_31->2_26 +2_31->2_28 +2_32->2_33 +2_33->2_30 +2_34->2_35 +2_35->2_4 +2_35->2_32 +2_36->2_37 +2_37->2_30 +2_37->2_4 +2_38->2_39 +2_38->2_53 +2_39->2_36 +2_39->2_16 +2_40->2_36 +2_40->2_32 +2_41->2_42 +2_42->2_38 +2_42->2_20 +2_43->2_44 +2_44->2_41 +2_45->2_46 +2_46->2_4 +2_46->2_43 +2_47->2_36 +2_47->2_43 +2_48->2_45 +2_48->2_28 +2_49->2_50 +2_50->2_34 +2_50->2_12 +2_51->2_52 +2_52->2_49 +2_53->2_6 +2_53->2_51 +} + } diff --git a/test-shared/src/test/resources/correctness/tree/LoopDyck/twoPairs/result.dot b/test-shared/src/test/resources/correctness/tree/LoopDyck/twoPairs/result.dot index ec8facdb3..fa05f0511 100644 --- a/test-shared/src/test/resources/correctness/tree/LoopDyck/twoPairs/result.dot +++ b/test-shared/src/test/resources/correctness/tree/LoopDyck/twoPairs/result.dot @@ -1,55 +1,105 @@ digraph g { labelloc="t" label="" -0 [label = "Epsilon RSM: S_0, input: [1, 1]", shape = invhouse] -1 [label = "Epsilon RSM: S_0, input: [3, 3]", shape = invhouse] -2 [label = "Intermediate input: 1, rsm: S_1, input: [0, 1]", shape = plain] -3 [label = "Intermediate input: 1, rsm: S_2, input: [0, 2]", shape = plain] -4 [label = "Intermediate input: 2, rsm: S_0, input: [0, 3]", shape = plain] -5 [label = "Intermediate input: 3, rsm: S_1, input: [0, 3]", shape = plain] -6 [label = "Intermediate input: 3, rsm: S_2, input: [0, 4]", shape = plain] -7 [label = "Nonterminal S, input: [1, 1]", shape = invtrapezium] -8 [label = "Nonterminal S, input: [3, 3]", shape = invtrapezium] -9 [label = "Range , input: [0, 1], rsm: [S_0, S_1]", shape = ellipse] -10 [label = "Range , input: [0, 1], rsm: [S_0, S_2]", shape = ellipse] -11 [label = "Range , input: [0, 2], rsm: [S_0, S_0]", shape = ellipse] -12 [label = "Range , input: [0, 3], rsm: [S_0, S_1]", shape = ellipse] -13 [label = "Range , input: [0, 3], rsm: [S_0, S_2]", shape = ellipse] -14 [label = "Range , input: [0, 4], rsm: [S_0, S_0]", shape = ellipse] -15 [label = "Range , input: [1, 1], rsm: [S_0, S_0]", shape = ellipse] -16 [label = "Range , input: [1, 1], rsm: [S_1, S_2]", shape = ellipse] -17 [label = "Range , input: [1, 2], rsm: [S_2, S_0]", shape = ellipse] -18 [label = "Range , input: [2, 3], rsm: [S_0, S_1]", shape = ellipse] -19 [label = "Range , input: [3, 3], rsm: [S_0, S_0]", shape = ellipse] -20 [label = "Range , input: [3, 3], rsm: [S_1, S_2]", shape = ellipse] -21 [label = "Range , input: [3, 4], rsm: [S_2, S_0]", shape = ellipse] -22 [label = "Terminal '(', input: [0, 1]", shape = rectangle] -23 [label = "Terminal '(', input: [2, 3]", shape = rectangle] -24 [label = "Terminal ')', input: [1, 2]", shape = rectangle] -25 [label = "Terminal ')', input: [3, 4]", shape = rectangle] -2->9 -2->16 -3->10 -3->17 -4->11 -4->18 -5->12 -5->20 -6->13 -6->21 -7->15 -8->19 -9->22 -10->2 -11->3 -12->4 -13->5 -14->6 -15->0 -16->7 -17->24 -18->23 -19->1 -20->8 -21->25 +subgraph cluster_0{ +labelloc="t" +0_0 [label = "73Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_1 [label = "74Terminal TerminalType(terminal=()", shape = rectangle] +0_2 [label = "76Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_3 [label = "77Epsilon EpsilonNonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invhouse] +0_4 [label = "78Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_5 [label = "79Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invtrapezium] +0_6 [label = "80Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_7 [label = "81Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=1), inputPosition=1)", shape = plain] +0_8 [label = "82Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_9 [label = "83Terminal TerminalType(terminal=))", shape = rectangle] +0_10 [label = "84Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_11 [label = "85Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=2), inputPosition=1)", shape = plain] +0_12 [label = "86Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_13 [label = "87Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invtrapezium] +0_0->0_1 +0_2->0_3 +0_4->0_5 +0_5->0_2 +0_6->0_7 +0_7->0_0 +0_7->0_4 +0_8->0_9 +0_10->0_11 +0_11->0_6 +0_11->0_8 +0_12->0_13 +0_13->0_10 +} + +subgraph cluster_1{ +labelloc="t" +1_0 [label = "69Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +1_1 [label = "70Epsilon EpsilonNonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invhouse] +1_2 [label = "71Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +1_3 [label = "72Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invtrapezium] +1_0->1_1 +1_2->1_3 +1_3->1_0 +} + +subgraph cluster_2{ +labelloc="t" +2_0 [label = "100Terminal TerminalType(terminal=))", shape = rectangle] +2_1 [label = "101Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_2 [label = "102Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=2), inputPosition=3)", shape = plain] +2_3 [label = "103Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_4 [label = "104Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invtrapezium] +2_5 [label = "73Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_6 [label = "74Terminal TerminalType(terminal=()", shape = rectangle] +2_7 [label = "76Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_8 [label = "77Epsilon EpsilonNonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invhouse] +2_9 [label = "78Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_10 [label = "79Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invtrapezium] +2_11 [label = "80Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_12 [label = "81Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=1), inputPosition=1)", shape = plain] +2_13 [label = "82Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_14 [label = "83Terminal TerminalType(terminal=))", shape = rectangle] +2_15 [label = "84Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_16 [label = "85Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=2), inputPosition=1)", shape = plain] +2_17 [label = "88Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_18 [label = "89Terminal TerminalType(terminal=()", shape = rectangle] +2_19 [label = "90Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_20 [label = "91Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0), inputPosition=2)", shape = plain] +2_21 [label = "93Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_22 [label = "94Epsilon EpsilonNonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invhouse] +2_23 [label = "95Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_24 [label = "96Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=true, numId=0))", shape = invtrapezium] +2_25 [label = "97Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_26 [label = "98Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=1), inputPosition=3)", shape = plain] +2_27 [label = "99Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +2_1->2_2 +2_2->2_25 +2_2->2_27 +2_3->2_4 +2_4->2_1 +2_5->2_6 +2_7->2_8 +2_9->2_10 +2_10->2_7 +2_11->2_12 +2_12->2_5 +2_12->2_9 +2_13->2_14 +2_15->2_16 +2_16->2_11 +2_16->2_13 +2_17->2_18 +2_19->2_20 +2_20->2_15 +2_20->2_17 +2_21->2_22 +2_23->2_24 +2_24->2_21 +2_25->2_26 +2_26->2_19 +2_26->2_23 +2_27->2_0 +} + } diff --git a/test-shared/src/test/resources/correctness/tree/SALang/linear/result.dot b/test-shared/src/test/resources/correctness/tree/SALang/linear/result.dot index 53b75dfe8..55a6d2c2c 100644 --- a/test-shared/src/test/resources/correctness/tree/SALang/linear/result.dot +++ b/test-shared/src/test/resources/correctness/tree/SALang/linear/result.dot @@ -1,35 +1,43 @@ digraph g { labelloc="t" label="" -0 [label = "Intermediate input: 1, rsm: A_1, input: [0, 2]", shape = plain] -1 [label = "Intermediate input: 1, rsm: S_2, input: [0, 2]", shape = plain] -2 [label = "Intermediate input: 2, rsm: S_1, input: [0, 3]", shape = plain] -3 [label = "Nonterminal A, input: [0, 2]", shape = invtrapezium] -4 [label = "Range , input: [0, 1], rsm: [A_0, A_1]", shape = ellipse] -5 [label = "Range , input: [0, 1], rsm: [S_0, S_2]", shape = ellipse] -6 [label = "Range , input: [0, 2], rsm: [A_0, A_2]", shape = ellipse] -7 [label = "Range , input: [0, 2], rsm: [S_0, S_1]", shape = ellipse] -8 [label = "Range , input: [0, 3], rsm: [S_0, S_3]", shape = ellipse] -9 [label = "Range , input: [1, 2], rsm: [A_1, A_2]", shape = ellipse] -10 [label = "Range , input: [1, 2], rsm: [S_2, S_1]", shape = ellipse] -11 [label = "Range , input: [2, 3], rsm: [S_1, S_3]", shape = ellipse] -12 [label = "Terminal 'a', input: [0, 1]", shape = rectangle] -13 [label = "Terminal 'b', input: [1, 2]", shape = rectangle] -14 [label = "Terminal 'c', input: [2, 3]", shape = rectangle] -0->4 -0->9 -1->5 -1->10 -2->7 -2->11 -3->6 -4->12 -5->12 -6->0 -7->3 -7->1 -8->2 -9->13 -10->13 -11->14 +subgraph cluster_0{ +labelloc="t" +0_0 [label = "40Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_1 [label = "41Terminal TerminalType(terminal=a)", shape = rectangle] +0_2 [label = "43Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_3 [label = "45Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_4 [label = "46Terminal TerminalType(terminal=b)", shape = rectangle] +0_5 [label = "47Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_6 [label = "48Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(A), isStart=false, isFinal=false, numId=1), inputPosition=1)", shape = plain] +0_7 [label = "49Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_8 [label = "50Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(A), isStart=true, isFinal=false, numId=0))", shape = invtrapezium] +0_9 [label = "51Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_10 [label = "52Terminal TerminalType(terminal=c)", shape = rectangle] +0_11 [label = "53Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_12 [label = "54Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=1), inputPosition=2)", shape = plain] +0_13 [label = "55Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_14 [label = "56Nonterminal NonterminalType(startState=RsmState(nonterminal=Nonterminal(S), isStart=true, isFinal=false, numId=0))", shape = invtrapezium] +0_15 [label = "57Range org.ucfs.sppf.node.Range@6970140a", shape = ellipse] +0_16 [label = "60Intermediate IntermediateType(grammarSlot=RsmState(nonterminal=Nonterminal(S), isStart=false, isFinal=false, numId=2), inputPosition=1)", shape = plain] +0_0->0_1 +0_2->0_1 +0_3->0_4 +0_5->0_6 +0_6->0_2 +0_6->0_3 +0_7->0_8 +0_7->0_16 +0_8->0_5 +0_9->0_10 +0_11->0_12 +0_12->0_7 +0_12->0_9 +0_13->0_14 +0_14->0_11 +0_15->0_4 +0_16->0_0 +0_16->0_15 +} + } diff --git a/test-shared/src/test/resources/correctness/tree/SimplifiedDyck/linear/input.dot b/test-shared/src/test/resources/correctness/tree/SimplifiedDyck/linear/input.dot index 15d31f953..8b489406c 100644 --- a/test-shared/src/test/resources/correctness/tree/SimplifiedDyck/linear/input.dot +++ b/test-shared/src/test/resources/correctness/tree/SimplifiedDyck/linear/input.dot @@ -1,5 +1,5 @@ digraph Input { start -> 0; - 0 -> 1 [label = "("]; - 1 -> 2 [label = ")"]; + 0 -> 1 [label = "("]; + 1 -> 2 [label = ")"]; } \ No newline at end of file diff --git a/test-shared/src/test/resources/correctness/tree/SimplifiedDyck/linear/result.dot b/test-shared/src/test/resources/correctness/tree/SimplifiedDyck/linear/result.dot index 851619986..8a05bebe2 100644 --- a/test-shared/src/test/resources/correctness/tree/SimplifiedDyck/linear/result.dot +++ b/test-shared/src/test/resources/correctness/tree/SimplifiedDyck/linear/result.dot @@ -1,27 +1,42 @@ digraph g { labelloc="t" label="" -0 [label = "Epsilon RSM: S_0, input: [1, 1]", shape = invhouse] -1 [label = "Intermediate input: 1, rsm: S_1, input: [0, 1]", shape = plain] -2 [label = "Intermediate input: 1, rsm: S_2, input: [0, 2]", shape = plain] -3 [label = "Nonterminal S, input: [1, 1]", shape = invtrapezium] -4 [label = "Range , input: [0, 1], rsm: [S_0, S_1]", shape = ellipse] -5 [label = "Range , input: [0, 1], rsm: [S_0, S_2]", shape = ellipse] -6 [label = "Range , input: [0, 2], rsm: [S_0, S_3]", shape = ellipse] -7 [label = "Range , input: [1, 1], rsm: [S_0, S_0]", shape = ellipse] -8 [label = "Range , input: [1, 1], rsm: [S_1, S_2]", shape = ellipse] -9 [label = "Range , input: [1, 2], rsm: [S_2, S_3]", shape = ellipse] -10 [label = "Terminal '(', input: [0, 1]", shape = rectangle] -11 [label = "Terminal ')', input: [1, 2]", shape = rectangle] -1->4 -1->8 -2->5 -2->9 -3->7 -4->10 -5->1 -6->2 -7->0 -8->3 -9->11 +subgraph cluster_0{ +labelloc="t" +_0_0 [label = "Epsilon S_0", shape = invhouse] +_0_1 [label = "Nonterminal S input:[0;0] rsm:[fictiveStart_0;fictiveStart_1]", shape = invtrapezium] +_0_2 [label = "Range input:[0;0] rsm:[S_0;S_0]", shape = ellipse] +_0_1->_0_2 +_0_2->_0_0 +} + +subgraph cluster_1{ +labelloc="t" +_1_0 [label = "Epsilon S_0", shape = invhouse] +_1_1 [label = "Intermediate input:1 rsm:S_1", shape = plain] +_1_2 [label = "Intermediate input:1 rsm:S_2", shape = plain] +_1_3 [label = "Nonterminal S input:[0;2] rsm:[fictiveStart_0;fictiveStart_1]", shape = invtrapezium] +_1_4 [label = "Nonterminal S input:[1;1] rsm:[S_1;S_2]", shape = invtrapezium] +_1_5 [label = "Range input:[0;1] rsm:[S_0;S_1]", shape = ellipse] +_1_6 [label = "Range input:[0;1] rsm:[S_0;S_2]", shape = ellipse] +_1_7 [label = "Range input:[0;2] rsm:[S_0;S_3]", shape = ellipse] +_1_8 [label = "Range input:[1;1] rsm:[S_0;S_0]", shape = ellipse] +_1_9 [label = "Range input:[1;1] rsm:[S_1;S_2]", shape = ellipse] +_1_10 [label = "Range input:[1;2] rsm:[S_2;S_3]", shape = ellipse] +_1_11 [label = "Terminal `(` input:[0;1]", shape = rectangle] +_1_12 [label = "Terminal `)` input:[1;2]", shape = rectangle] +_1_1->_1_5 +_1_1->_1_9 +_1_2->_1_6 +_1_2->_1_10 +_1_3->_1_7 +_1_4->_1_8 +_1_5->_1_11 +_1_6->_1_1 +_1_7->_1_2 +_1_8->_1_0 +_1_9->_1_4 +_1_10->_1_12 +} + } diff --git a/test-shared/src/test/resources/correctness/tree/StrangeDyck/linear/input.dot b/test-shared/src/test/resources/correctness/tree/StrangeDyck/linear/input.dot new file mode 100644 index 000000000..c7cc8faa7 --- /dev/null +++ b/test-shared/src/test/resources/correctness/tree/StrangeDyck/linear/input.dot @@ -0,0 +1,6 @@ +digraph Input { + start -> 0; + 0 -> 1 [label = "("]; + 4 -> 2 [label = "a"]; + 2 -> 3 [label = ")"]; +} \ No newline at end of file diff --git a/test-shared/src/test/resources/correctness/tree/StrangeDyck/linear/result.dot b/test-shared/src/test/resources/correctness/tree/StrangeDyck/linear/result.dot new file mode 100644 index 000000000..1f23a36c4 --- /dev/null +++ b/test-shared/src/test/resources/correctness/tree/StrangeDyck/linear/result.dot @@ -0,0 +1,29 @@ +digraph g { +labelloc="t" +label="" +0 [label = "Epsilon RSM: S_0, input: [1, 1]", shape = invhouse] +1 [label = "Intermediate input: 1, rsm: S_1, input: [0, 1]", shape = plain] +2 [label = "Intermediate input: 1, rsm: S_2, input: [0, 2]", shape = plain] +3 [label = "Nonterminal S, input: [0, 2]", shape = invtrapezium] +4 [label = "Nonterminal S, input: [1, 1]", shape = invtrapezium] +5 [label = "Range , input: [0, 1], rsm: [S_0, S_1]", shape = ellipse] +6 [label = "Range , input: [0, 1], rsm: [S_0, S_2]", shape = ellipse] +7 [label = "Range , input: [0, 2], rsm: [S_0, S_3]", shape = ellipse] +8 [label = "Range , input: [1, 1], rsm: [S_0, S_0]", shape = ellipse] +9 [label = "Range , input: [1, 1], rsm: [S_1, S_2]", shape = ellipse] +10 [label = "Range , input: [1, 2], rsm: [S_2, S_3]", shape = ellipse] +11 [label = "Terminal '(', input: [0, 1]", shape = rectangle] +12 [label = "Terminal ')', input: [1, 2]", shape = rectangle] +1->5 +1->9 +2->6 +2->10 +3->7 +4->8 +5->11 +6->1 +7->2 +8->0 +9->4 +10->12 +} diff --git a/test-shared/src/test/resources/todo/LoopDyck/minimalWorstCase/input.dot b/test-shared/src/test/resources/todo/LoopDyck/minimalWorstCase/input.dot new file mode 100644 index 000000000..7c08420c5 --- /dev/null +++ b/test-shared/src/test/resources/todo/LoopDyck/minimalWorstCase/input.dot @@ -0,0 +1,7 @@ +digraph Input { + label="Minimal worst case, simple loop RSM for Dyck language" + start -> 0; + 0 -> 0 [label = "("]; + 0 -> 1 [label = ")"]; + 1 -> 0 [label = ")"]; +} \ No newline at end of file diff --git a/test-shared/src/test/resources/todo/LoopDyck/minimalWorstCase/result.dot b/test-shared/src/test/resources/todo/LoopDyck/minimalWorstCase/result.dot new file mode 100644 index 000000000..8e702aee9 --- /dev/null +++ b/test-shared/src/test/resources/todo/LoopDyck/minimalWorstCase/result.dot @@ -0,0 +1,43 @@ +digraph g { +labelloc="t" +label="" +0 [label = "Epsilon RSM: S_0, input: [0, 0]", shape = invhouse] +1 [label = "Intermediate input: 0, rsm: S_1, input: [0, 0]", shape = plain] +2 [label = "Intermediate input: 0, rsm: S_1, input: [0, 1]", shape = plain] +3 [label = "Intermediate input: 0, rsm: S_2, input: [0, 1]", shape = plain] +4 [label = "Intermediate input: 1, rsm: S_2, input: [0, 0]", shape = plain] +5 [label = "Nonterminal S, input: [0, 0]", shape = invtrapezium] +6 [label = "Nonterminal S, input: [0, 1]", shape = invtrapezium] +7 [label = "Range , input: [0, 0], rsm: [S_0, S_0]", shape = ellipse] +8 [label = "Range , input: [0, 0], rsm: [S_0, S_1]", shape = ellipse] +9 [label = "Range , input: [0, 0], rsm: [S_0, S_2]", shape = ellipse] +10 [label = "Range , input: [0, 0], rsm: [S_1, S_2]", shape = ellipse] +11 [label = "Range , input: [0, 1], rsm: [S_0, S_0]", shape = ellipse] +12 [label = "Range , input: [0, 1], rsm: [S_0, S_2]", shape = ellipse] +13 [label = "Range , input: [0, 1], rsm: [S_1, S_2]", shape = ellipse] +14 [label = "Range , input: [0, 1], rsm: [S_2, S_0]", shape = ellipse] +15 [label = "Range , input: [1, 0], rsm: [S_2, S_0]", shape = ellipse] +16 [label = "Terminal '(', input: [0, 0]", shape = rectangle] +17 [label = "Terminal ')', input: [0, 1]", shape = rectangle] +18 [label = "Terminal ')', input: [1, 0]", shape = rectangle] +1->8 +1->10 +2->8 +2->13 +3->9 +3->14 +4->12 +4->15 +5->7 +6->11 +7->0 +7->4 +8->16 +9->1 +10->5 +11->3 +12->2 +13->6 +14->17 +15->18 +}