1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
with Packrat.Parse_Graphs;
package body Rat_Tests.Parse_Graphs is
type My_Labels is
(Noun, Determiner, Noun_Phrase, Preposition,
Prepositional_Phrase, Verb, Verb_Phrase, Sentence);
package String_Tokens is new Packrat.Tokens (My_Labels, Character, String);
package Graphs is new Packrat.Parse_Graphs (My_Labels, Character, String, String_Tokens);
Paper_Nodes : Graphs.Node_Array :=
(1, -- Noun at position 1, value "i"
2, -- Noun at position 4, value "man"
3, -- Noun at position 7, value "park"
4, -- Noun at position 10, value "bat"
5, -- Determiner at position 3, value "a"
6, -- Determiner at position 6, value "the"
7, -- Determiner at position 9, value "a"
8, -- Noun_Phrase at position 1
9, -- Noun_Phrase at position 3
10, -- Noun_Phrase at position 6
11, -- Noun_Phrase at position 9
12, -- Preposition at position 5, value "in"
13, -- Preposition at position 8, value "with"
14, -- Prepositional_Phrase at position 5
15, -- Prepositional_Phrase at position 8
16, -- Verb at position 2, value "saw"
17, -- Verb_Phrase at position 2
18); -- Sentence at position 1
-- Cursors in Directed Graph library should be tagged
-- This will allow creation of an extended Cursor type in Parse Graphs
-- Edge labels need to contain group, finish, order, and restrict
-- The extended Cursor type should take the restrict into account with its functions
-- There should be a validity checking function for Parse Graphs
-- There should also be a pretty print debug function for Parse Graphs
Paper_Edges : Graphs.Edge_Array :=
((1, 8, 1) -- Finish 2, Order 1
(2, 9, 5) -- Finish 5, Order 1
(3, 9, 2); -- Finish 5, Order 2
Paper_Graph : Graphs.Parse_Graph := Graphs.To_Graph (Amb_Nodes, Amb_Edges, 18);
function Root_Check
return Test_Result
is
begin
end Root_Check;
function Finish_List_Check
return Test_Result
is
begin
end Finish_List_Check;
function Sub_Nodes_Check
return Test_Result
is
begin
end Sub_Nodes_Check;
function Prune_Check
return Test_Result
is
begin
end Prune_Check;
function Ambiguous_Check
return Test_Result
is
begin
end Ambiguous_Check;
begin
-- Node labels
Paper_Graph.Append_Label (1, String_Tokens.Create (Noun, 1, "i"));
Paper_Graph.Append_Label (2, String_Tokens.Create (Noun, 4, "man"));
Paper_Graph.Append_Label (3, String_Tokens.Create (Noun, 7, "park"));
Paper_Graph.Append_Label (4, String_Tokens.Create (Noun, 10, "bat"));
Paper_Graph.Append_Label (5, String_Tokens.Create (Determiner, 3, "a"));
Paper_Graph.Append_Label (6, String_Tokens.Create (Determiner, 6, "the"));
Paper_Graph.Append_Label (7, String_Tokens.Create (Determiner, 9, "a"));
Paper_Graph.Append_Label (8, String_Tokens.Create (Noun_Phrase, 1, ""));
Paper_Graph.Append_Label (9, String_Tokens.Create (Noun_Phrase, 3, ""));
Paper_Graph.Append_Label (10, String_Tokens.Create (Noun_Phrase, 6, ""));
Paper_Graph.Append_Label (11, String_Tokens.Create (Noun_Phrase, 9, ""));
Paper_Graph.Append_Label (12, String_Tokens.Create (Preposition, 5, "in"));
Paper_Graph.Append_Label (13, String_Tokens.Create (Preposition, 8, "with"));
Paper_Graph.Append_Label (14, String_Tokens.Create (Prepositional_Phrase, 5, ""));
Paper_Graph.Append_Label (15, String_Tokens.Create (Prepositional_Phrase, 8, ""));
Paper_Graph.Append_Label (16, String_Tokens.Create (Verb, 2, "saw"));
Paper_Graph.Append_Label (17, String_Tokens.Create (Verb_Phrase, 2, ""));
Paper_Graph.Append_Label (18, String_Tokens.Create (Sentence, 1, ""));
-- Edge labels
end Rat_Tests.Parse_Graphs;
|