Skip to content

Tree correctness #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: bachish/tree-correctness
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions test-shared/gen/CubicSPPFLangRsm
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
digraph g {
S_0 [label = "S,S_0", shape = doublecircle, color = green]
S_1 [label = "S,S_1", shape = circle, color = black]
S_2 [label = "S,S_2", shape = circle, color = black]
S_3 [label = "S,S_3", shape = circle, color = black]
S_4 [label = "S,S_4", shape = doublecircle, color = red]
S_0 -> S_1 [label = "a"]
S_1 -> S_2 [label = "S"]
S_2 -> S_3 [label = "a"]
S_3 -> S_4 [label = "S"]
subgraph cluster_S {
S_0
S_1
S_2
S_3
S_4
label = "S"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ abstract class AbstractCorrectnessTest {

abstract fun getRootDataFolder(): Path

val grammars = listOf(SimplifiedDyck(), ABGrammar(), SALang(), Epsilon(), LoopDyck(), AmbiguousAStar2(), AmbiguousAStar1())
val grammars = listOf(SimplifiedDyck(), ABGrammar(), SALang(), Epsilon(), LoopDyck(), AmbiguousAStar2(), AmbiguousAStar1(), CubicSPPFLang(), CubicSPPFLang())
//TODO return only one result for ambiguous AmbiguousAStar2(), AmbiguousAStar1()
// TODO fix worst case for loopdyck
val regenerate = false
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
digraph Input {
start -> 0;
0 -> 1 [label = "a"];
1 -> 2 [label = "a"];
2 -> 3 [label = "a"];
3 -> 4 [label = "a"];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
digraph g {
labelloc="t"
label=""
subgraph cluster_0{
labelloc="t"
_0_0 [label = "2 Range input:[0;0] rsm:[S_0;S_0]", shape = ellipse]
_0_1 [label = "3 Epsilon S_0", shape = invhouse]
_0_2 [label = "5 Nonterminal S input:[0;0] rsm:[fictiveStart_0;fictiveStart_1]", shape = invtrapezium]
_0_0->_0_1
_0_2->_0_0
}

subgraph cluster_1{
labelloc="t"
_1_0 [label = "10 Epsilon S_0", shape = invhouse]
_1_1 [label = "11 Range input:[1;1] rsm:[S_1;S_2]", shape = ellipse]
_1_2 [label = "12 Nonterminal S input:[1;1] rsm:[S_1;S_2]", shape = invtrapezium]
_1_3 [label = "121 Range input:[1;2] rsm:[S_2;S_3]", shape = ellipse]
_1_4 [label = "123 Range input:[0;2] rsm:[S_0;S_3]", shape = ellipse]
_1_5 [label = "124 Intermediate input:1 rsm:S_2", shape = plain]
_1_6 [label = "126 Range input:[2;2] rsm:[S_3;S_4]", shape = ellipse]
_1_7 [label = "127 Nonterminal S input:[2;2] rsm:[S_3;S_4]", shape = invtrapezium]
_1_8 [label = "128 Range input:[0;2] rsm:[S_0;S_4]", shape = ellipse]
_1_9 [label = "129 Intermediate input:2 rsm:S_3", shape = plain]
_1_10 [label = "13 Range input:[0;1] rsm:[S_0;S_2]", shape = ellipse]
_1_11 [label = "135 Nonterminal S input:[0;2] rsm:[fictiveStart_0;fictiveStart_1]", shape = invtrapezium]
_1_12 [label = "14 Intermediate input:1 rsm:S_1", shape = plain]
_1_13 [label = "16 Terminal `a` input:[1;2]", shape = rectangle]
_1_14 [label = "18 Range input:[2;2] rsm:[S_0;S_0]", shape = ellipse]
_1_15 [label = "19 Epsilon S_0", shape = invhouse]
_1_16 [label = "6 Range input:[0;1] rsm:[S_0;S_1]", shape = ellipse]
_1_17 [label = "7 Terminal `a` input:[0;1]", shape = rectangle]
_1_18 [label = "9 Range input:[1;1] rsm:[S_0;S_0]", shape = ellipse]
_1_1->_1_2
_1_2->_1_18
_1_3->_1_13
_1_4->_1_5
_1_5->_1_10
_1_5->_1_3
_1_6->_1_7
_1_7->_1_14
_1_8->_1_9
_1_9->_1_4
_1_9->_1_6
_1_10->_1_12
_1_11->_1_8
_1_12->_1_16
_1_12->_1_1
_1_14->_1_15
_1_16->_1_17
_1_18->_1_0
}

subgraph cluster_2{
labelloc="t"
_2_0 [label = "10 Epsilon S_0", shape = invhouse]
_2_1 [label = "11 Range input:[1;1] rsm:[S_1;S_2]", shape = ellipse]
_2_2 [label = "12 Nonterminal S input:[1;1] rsm:[S_1;S_2]", shape = invtrapezium]
_2_3 [label = "121 Range input:[1;2] rsm:[S_2;S_3]", shape = ellipse]
_2_4 [label = "123 Range input:[0;2] rsm:[S_0;S_3]", shape = ellipse]
_2_5 [label = "124 Intermediate input:1 rsm:S_2", shape = plain]
_2_6 [label = "13 Range input:[0;1] rsm:[S_0;S_2]", shape = ellipse]
_2_7 [label = "130 Range input:[2;4] rsm:[S_3;S_4]", shape = ellipse]
_2_8 [label = "131 Nonterminal S input:[2;4] rsm:[S_3;S_4]", shape = invtrapezium]
_2_9 [label = "133 Intermediate input:2 rsm:S_3", shape = plain]
_2_10 [label = "14 Intermediate input:1 rsm:S_1", shape = plain]
_2_11 [label = "15 Range input:[1;2] rsm:[S_0;S_1]", shape = ellipse]
_2_12 [label = "16 Terminal `a` input:[1;2]", shape = rectangle]
_2_13 [label = "18 Range input:[2;2] rsm:[S_0;S_0]", shape = ellipse]
_2_14 [label = "19 Epsilon S_0", shape = invhouse]
_2_15 [label = "20 Range input:[2;2] rsm:[S_1;S_2]", shape = ellipse]
_2_16 [label = "21 Nonterminal S input:[2;2] rsm:[S_1;S_2]", shape = invtrapezium]
_2_17 [label = "22 Range input:[1;2] rsm:[S_0;S_2]", shape = ellipse]
_2_18 [label = "23 Intermediate input:2 rsm:S_1", shape = plain]
_2_19 [label = "25 Terminal `a` input:[2;3]", shape = rectangle]
_2_20 [label = "27 Range input:[3;3] rsm:[S_0;S_0]", shape = ellipse]
_2_21 [label = "28 Epsilon S_0", shape = invhouse]
_2_22 [label = "34 Terminal `a` input:[3;4]", shape = rectangle]
_2_23 [label = "36 Range input:[4;4] rsm:[S_0;S_0]", shape = ellipse]
_2_24 [label = "37 Epsilon S_0", shape = invhouse]
_2_25 [label = "42 Range input:[3;4] rsm:[S_2;S_3]", shape = ellipse]
_2_26 [label = "47 Range input:[4;4] rsm:[S_3;S_4]", shape = ellipse]
_2_27 [label = "48 Nonterminal S input:[4;4] rsm:[S_3;S_4]", shape = invtrapezium]
_2_28 [label = "6 Range input:[0;1] rsm:[S_0;S_1]", shape = ellipse]
_2_29 [label = "65 Range input:[2;3] rsm:[S_2;S_3]", shape = ellipse]
_2_30 [label = "67 Range input:[1;3] rsm:[S_0;S_3]", shape = ellipse]
_2_31 [label = "68 Intermediate input:2 rsm:S_2", shape = plain]
_2_32 [label = "7 Terminal `a` input:[0;1]", shape = rectangle]
_2_33 [label = "70 Range input:[3;3] rsm:[S_3;S_4]", shape = ellipse]
_2_34 [label = "71 Nonterminal S input:[3;3] rsm:[S_3;S_4]", shape = invtrapezium]
_2_35 [label = "72 Range input:[1;3] rsm:[S_0;S_4]", shape = ellipse]
_2_36 [label = "73 Intermediate input:3 rsm:S_3", shape = plain]
_2_37 [label = "74 Range input:[1;3] rsm:[S_1;S_2]", shape = ellipse]
_2_38 [label = "75 Nonterminal S input:[1;3] rsm:[S_1;S_2]", shape = invtrapezium]
_2_39 [label = "76 Range input:[0;3] rsm:[S_0;S_2]", shape = ellipse]
_2_40 [label = "77 Intermediate input:1 rsm:S_1", shape = plain]
_2_41 [label = "80 Range input:[0;4] rsm:[S_0;S_3]", shape = ellipse]
_2_42 [label = "81 Intermediate input:3 rsm:S_2", shape = plain]
_2_43 [label = "85 Range input:[0;4] rsm:[S_0;S_4]", shape = ellipse]
_2_44 [label = "86 Intermediate input:4 rsm:S_3", shape = plain]
_2_45 [label = "9 Range input:[1;1] rsm:[S_0;S_0]", shape = ellipse]
_2_46 [label = "92 Nonterminal S input:[0;4] rsm:[fictiveStart_0;fictiveStart_1]", shape = invtrapezium]
_2_1->_2_2
_2_2->_2_45
_2_3->_2_12
_2_4->_2_5
_2_5->_2_6
_2_5->_2_3
_2_6->_2_10
_2_7->_2_8
_2_9->_2_4
_2_9->_2_7
_2_10->_2_28
_2_10->_2_1
_2_11->_2_12
_2_13->_2_14
_2_15->_2_16
_2_16->_2_13
_2_17->_2_18
_2_18->_2_11
_2_18->_2_15
_2_20->_2_21
_2_23->_2_24
_2_25->_2_22
_2_26->_2_27
_2_27->_2_23
_2_28->_2_32
_2_29->_2_19
_2_30->_2_31
_2_31->_2_17
_2_31->_2_29
_2_33->_2_34
_2_34->_2_20
_2_35->_2_36
_2_36->_2_30
_2_36->_2_33
_2_37->_2_38
_2_38->_2_35
_2_39->_2_40
_2_40->_2_28
_2_40->_2_37
_2_41->_2_42
_2_42->_2_39
_2_42->_2_25
_2_43->_2_44
_2_43->_2_9
_2_44->_2_41
_2_44->_2_26
_2_45->_2_0
_2_46->_2_43
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
digraph Input {
start -> 0;
0 -> 1 [label = "a"];
1 -> 2 [label = "a"];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
digraph g {
labelloc="t"
label=""
subgraph cluster_0{
labelloc="t"
_0_0 [label = "150 Range input:[0;0] rsm:[S_0;S_0]", shape = ellipse]
_0_1 [label = "151 Epsilon S_0", shape = invhouse]
_0_2 [label = "153 Nonterminal S input:[0;0] rsm:[fictiveStart_0;fictiveStart_1]", shape = invtrapezium]
_0_0->_0_1
_0_2->_0_0
}

subgraph cluster_1{
labelloc="t"
_1_0 [label = "154 Range input:[0;1] rsm:[S_0;S_1]", shape = ellipse]
_1_1 [label = "155 Terminal `a` input:[0;1]", shape = rectangle]
_1_2 [label = "157 Range input:[1;1] rsm:[S_0;S_0]", shape = ellipse]
_1_3 [label = "158 Epsilon S_0", shape = invhouse]
_1_4 [label = "159 Range input:[1;1] rsm:[S_1;S_2]", shape = ellipse]
_1_5 [label = "160 Nonterminal S input:[1;1] rsm:[S_1;S_2]", shape = invtrapezium]
_1_6 [label = "161 Range input:[0;1] rsm:[S_0;S_2]", shape = ellipse]
_1_7 [label = "162 Intermediate input:1 rsm:S_1", shape = plain]
_1_8 [label = "164 Terminal `a` input:[1;2]", shape = rectangle]
_1_9 [label = "166 Range input:[2;2] rsm:[S_0;S_0]", shape = ellipse]
_1_10 [label = "167 Epsilon S_0", shape = invhouse]
_1_11 [label = "172 Range input:[1;2] rsm:[S_2;S_3]", shape = ellipse]
_1_12 [label = "174 Range input:[0;2] rsm:[S_0;S_3]", shape = ellipse]
_1_13 [label = "175 Intermediate input:1 rsm:S_2", shape = plain]
_1_14 [label = "177 Range input:[2;2] rsm:[S_3;S_4]", shape = ellipse]
_1_15 [label = "178 Nonterminal S input:[2;2] rsm:[S_3;S_4]", shape = invtrapezium]
_1_16 [label = "179 Range input:[0;2] rsm:[S_0;S_4]", shape = ellipse]
_1_17 [label = "180 Intermediate input:2 rsm:S_3", shape = plain]
_1_18 [label = "182 Nonterminal S input:[0;2] rsm:[fictiveStart_0;fictiveStart_1]", shape = invtrapezium]
_1_0->_1_1
_1_2->_1_3
_1_4->_1_5
_1_5->_1_2
_1_6->_1_7
_1_7->_1_0
_1_7->_1_4
_1_9->_1_10
_1_11->_1_8
_1_12->_1_13
_1_13->_1_6
_1_13->_1_11
_1_14->_1_15
_1_15->_1_9
_1_16->_1_17
_1_17->_1_12
_1_17->_1_14
_1_18->_1_16
}

}