Commit b67d60a3 authored by POTTIER Francois's avatar POTTIER Francois

Added [ocamltype_of_start_symbol].

parent ea451d48
......@@ -127,6 +127,14 @@ module Nonterminal = struct
with Not_found ->
None
let ocamltype_of_start_symbol nt =
match ocamltype nt with
| Some typ ->
typ
| None ->
(* Every start symbol has a type. *)
assert false
let tabulate f =
Array.get (Array.init n f)
......
......@@ -46,6 +46,11 @@ module Nonterminal : sig
val ocamltype: t -> Stretch.ocamltype option
(* A start symbol always has a type. This allows us to define
a simplified version of [ocamltype] for start symbols. *)
val ocamltype_of_start_symbol: t -> Stretch.ocamltype
(* Iteration over nonterminals. The order in which elements are
examined, and the order of [map]'s output list, correspond to the
numeric indices produced by [n2i] above. *)
......
......@@ -1102,11 +1102,7 @@ let fold_entry f accu =
assert false (* this is a start production *)
in
let t : Stretch.ocamltype =
match Nonterminal.ocamltype nt with
| Some t ->
t
| None ->
assert false (* every start symbol should carry a type *)
Nonterminal.ocamltype_of_start_symbol nt
in
f prod state nt t accu
) entry accu
......
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