Commit b85051b1 authored by POTTIER Francois's avatar POTTIER Francois

Include the start nonterminal symbol in the information produced by [entry_points].

parent a9879267
......@@ -47,11 +47,11 @@ module type GRAMMAR = sig
end
module Grammar : sig
val basename : string
val preludes : string list
val postludes : string list
val basename : string
val parameters : string list (* %parameter declarations *)
val entry_points : (production * lr1) list
val parameters : string list
val entry_points : (nonterminal * production * lr1) list
val attributes : Attribute.t list
end
......
......@@ -93,7 +93,7 @@ type grammar = {
g_productions : production_def array;
g_lr0_states : lr0_state_def array;
g_lr1_states : lr1_state_def array;
g_entry_points : (production * lr1) list;
g_entry_points : (nonterminal * production * lr1) list;
g_attributes : attributes;
g_parameters : string list;
}
......@@ -130,8 +130,8 @@ let lr1_state (node : Lr1.node) : lr1_state_def =
TerminalMap.fold_rev add (Lr1.reductions node) []
}
let entry_point prod node xs : (production * lr1) list =
(Production.p2i prod, Lr1.number node) :: xs
let entry_point prod node nt _typ accu : (nonterminal * production * lr1) list =
(Nonterminal.n2i nt, Production.p2i prod, Lr1.number node) :: accu
let encode () : grammar =
{
......@@ -143,7 +143,7 @@ let encode () : grammar =
g_productions = Production.init production;
g_lr0_states = Array.init Lr0.n lr0_state;
g_lr1_states = Array.of_list (Lr1.map lr1_state);
g_entry_points = ProductionMap.fold entry_point Lr1.entry [];
g_entry_points = Lr1.fold_entry entry_point [];
g_attributes = attributes Analysis.attributes;
g_parameters = List.map raw_content Front.grammar.parameters;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment