-let level1_pattern =
- Grammar.Entry.create level1_pattern_grammar "level1_pattern"
-let level2_ast = Grammar.Entry.create level2_ast_grammar "level2_ast"
-let term = Grammar.Entry.create level2_ast_grammar "term"
-let let_defs = Grammar.Entry.create level2_ast_grammar "let_defs"
-let protected_binder_vars = Grammar.Entry.create level2_ast_grammar "protected_binder_vars"
-let level2_meta = Grammar.Entry.create level2_meta_grammar "level2_meta"
+type ('a,'b,'c,'d) grammars = {
+ level1_pattern: 'a Grammar.Entry.e;
+ level2_ast: 'b Grammar.Entry.e;
+ level2_ast_grammar : Grammar.g;
+ term: 'b Grammar.Entry.e;
+ let_defs: 'c Grammar.Entry.e;
+ protected_binder_vars: 'd Grammar.Entry.e;
+ level2_meta: 'b Grammar.Entry.e;
+}
+
+let initial_grammars () =
+ let level1_pattern_grammar =
+ Grammar.gcreate (CicNotationLexer.level1_pattern_lexer ()) in
+ let level2_ast_grammar =
+ Grammar.gcreate (CicNotationLexer.level2_ast_lexer ()) in
+ let level2_meta_grammar =
+ Grammar.gcreate (CicNotationLexer.level2_meta_lexer ()) in
+ let level1_pattern =
+ Grammar.Entry.create level1_pattern_grammar "level1_pattern" in
+ let level2_ast = Grammar.Entry.create level2_ast_grammar "level2_ast" in
+ let term = Grammar.Entry.create level2_ast_grammar "term" in
+ let let_defs = Grammar.Entry.create level2_ast_grammar "let_defs" in
+ let protected_binder_vars =
+ Grammar.Entry.create level2_ast_grammar "protected_binder_vars" in
+ let level2_meta = Grammar.Entry.create level2_meta_grammar "level2_meta" in
+ { level1_pattern=level1_pattern;
+ level2_ast=level2_ast;
+ term=term;
+ let_defs=let_defs;
+ protected_binder_vars=protected_binder_vars;
+ level2_meta=level2_meta;
+ level2_ast_grammar=level2_ast_grammar;
+}
+;;
+
+let grammars = ref (initial_grammars ());;