Attention une mise à jour du service Gitlab va être effectuée le mardi 18 janvier (et non lundi 17 comme annoncé précédemment) entre 18h00 et 18h30. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes.

Commit 702125eb authored by POTTIER Francois's avatar POTTIER Francois
Browse files

Added the generation of the type [xsymbol].

parent b31f9963
......@@ -119,6 +119,7 @@ let inspection_api grammar () =
TokenType.tokengadtdef grammar @
NonterminalType.nonterminalgadtdef grammar @
SymbolType.symbolgadtdef() @
SymbolType.xsymboldef() @
IIComment "This function maps a state to its incoming symbol." ::
IIValDecls [
......
open IL
(* -------------------------------------------------------------------------- *)
(* The symbol GADT is the union of the terminal and nonterminal GADTs. *)
(* The conventional name of the symbol GADT. *)
......@@ -44,3 +46,37 @@ let symbolgadtdef () =
typeconstraint = None
}]
]
(* -------------------------------------------------------------------------- *)
(* We also need an existentially quantified version of the type ['a symbol].
This type is not parameterized. *)
let tcxsymbol =
"xsymbol"
let txsymbol =
TypApp (tcxsymbol, [])
let dataX =
"X"
let xsymboldef () =
assert Settings.inspection;
let a = "a" in
let datadefs =
{
dataname = dataX;
datavalparams = [ tsymbolgadt (TypVar a) ];
datatypeparams = Some []
} ::
[]
in
[ IIComment "The (non-indexed) type of terminal and nonterminal symbols.";
IITypeDecls [{
typename = tcxsymbol;
typeparams = [];
typerhs = TDefSum datadefs;
typeconstraint = None
}]
]
......@@ -12,3 +12,9 @@ val dataN: string
val symbolgadtdef: unit -> IL.interface
(* The type [xsymbol] is an existentially quantified version of the symbol
GADT above. Thus, it is not parameterized. *)
val txsymbol: IL.typ
val xsymboldef: unit -> IL.interface
......@@ -882,7 +882,8 @@ let program =
interface_to_structure (
tokengadtdef grammar @
nonterminalgadtdef grammar @
symbolgadtdef()
symbolgadtdef() @
xsymboldef()
) @
SIValDefs (false, [incoming_symbol_def]) ::
......
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