aboutsummaryrefslogtreecommitdiffhomepage
path: root/parsing/g_module.ml4
blob: 7e2532c200d0659c110af4920d0b8e4e2afd50a3 (plain)
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
(***********************************************************************)
(*  v      *   The Coq Proof Assistant  /  The Coq Development Team    *)
(* <O___,, *        INRIA-Rocquencourt  &  LRI-CNRS-Orsay              *)
(*   \VV/  *************************************************************)
(*    //   *      This file is distributed under the terms of the      *)
(*         *       GNU Lesser General Public License Version 2.1       *)
(***********************************************************************)

(* $Id$ *) 

open Pp
open Ast
open Pcoq
open Prim
open Module
open Util
open Topconstr

(* Grammar rules for module expressions and types *)

if !Options.v7 then
GEXTEND Gram
  GLOBAL: module_expr module_type;
 
  module_expr:
    [ [ qid = qualid -> CMEident qid
      | me1 = module_expr; me2 = module_expr -> CMEapply (me1,me2)
      | "("; me = module_expr; ")" -> me
(* ... *)
      ] ]
  ;

  with_declaration:
    [ [ "Definition"; id = base_ident; ":="; c = Constr.constr ->
          CWith_Definition (id,c)
      | IDENT "Module"; id = base_ident; ":="; qid = qualid ->
	  CWith_Module (id,qid)
      ] ]
  ;
  
  module_type:
    [ [ qid = qualid -> CMTEident qid
(* ... *)
      | mty = module_type; "with"; decl = with_declaration -> 
	  CMTEwith (mty,decl) ] ]
  ;
END