1 /* Copyright (C) 2000, HELM Team.
3 * This file is part of HELM, an Hypertextual, Electronic
4 * Library of Mathematics, developed at the Computer Science
5 * Department, University of Bologna, Italy.
7 * HELM is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * HELM is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with HELM; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
22 * For details, see the HELM World-Wide-Web page,
23 * http://cs.unibo.it/helm/.
31 let _ = Parsing.set_trace debug
34 %token <string> ID STR
35 %token OP CP OB CB OA CA FS CN CM EQ STAR HASH PLUS TE WTO STO
36 %token GRAPH DECL AX DEF TH OPEN CLOSE SORTS EOF
39 %type <Txt.command option * bool> entry
58 | ID CM ids { $1 :: $3 }
62 | IX ID { Some $1, $2 }
66 | sort CM sorts { $1 :: $3 }
70 | ID CN term { $1, true, $3 }
71 | TE CN term { "", false, $3 }
72 | TE ID CN term { $2, false, $4 }
75 | ID EQ term { $1, $3 }
79 | abst CM absts { $1 :: $3 }
83 | abbr CM abbrs { $1 :: $3 }
91 | STAR IX { T.Sort $2 }
92 | STAR ID { T.NSrt $2 }
93 | hash IX { T.LRef ($2, 0) }
94 | hash IX PLUS IX { T.LRef ($2, $4) }
95 | hash ID { T.NRef $2 }
99 | OA term CA fs term { T.Cast ($2, $5) }
100 | OP terms CP fs term { T.Appl ($2, $5) }
101 | atom OP terms CP { T.Inst ($1, $3) }
102 | OB binder CB fs term { T.Bind ($2, $5) }
103 | term WTO term { T.Impl (false, "", $1, $3) }
104 | TE CN term WTO term { T.Impl (false, "", $3, $5) }
105 | TE ID CN term WTO term { T.Impl (false, $2, $4, $6) }
106 | term STO term { T.Impl (true, "", $1, $3) }
107 | TE CN term STO term { T.Impl (true, "", $3, $5) }
108 | TE ID CN term STO term { T.Impl (true, $2, $4, $6) }
112 | term CM terms { $1 :: $3 }
125 { Some (T.Graph $2) }
126 | decl comment ID CN term
127 { Some (T.Entity ($1, $3, $2, $5)) }
128 | def comment ID EQ term
129 { Some (T.Entity ($1, $3, $2, $5)) }
130 | def comment ID EQ term CN term
131 { Some (T.Entity ($1, $3, $2, T.Cast ($7, $5))) }
133 { Some (T.Section (Some $2)) }
135 { Some (T.Section None) }
137 { Some (T.Sorts $2) }
142 | GRAPH {} | decl {} | def {}
143 | OPEN {} | CLOSE {} | SORTS {} | EOF {}
146 | xentity { $1, false }
147 | xentity start { $1, true }