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
36 %token GRAPH DECL AX DEF TH OPEN CLOSE SORTS EOF
39 %type <Txt.command option * bool> entry
55 | ID CM ids { $1 :: $3 }
59 | IX ID { Some $1, $2 }
63 | sort CM sorts { $1 :: $3 }
67 | ID CN term { $1, $3 }
70 | ID EQ term { $1, $3 }
74 | abst CM absts { $1 :: $3 }
78 | abbr CM abbrs { $1 :: $3 }
86 | STAR IX { T.Sort $2 }
87 | STAR ID { T.NSrt $2 }
88 | hash IX { T.LRef ($2, 0) }
89 | hash IX PLUS IX { T.LRef ($2, $4) }
90 | hash ID { T.NRef $2 }
94 | OA term CA fs term { T.Cast ($2, $5) }
95 | OP terms CP fs term { T.Appl ($2, $5) }
96 | atom OP terms CP { T.Appl (List.rev $3, $1) }
97 | OB binder CB fs term { T.Bind ($2, $5) }
101 | term CM terms { $1 :: $3 }
114 { Some (T.Graph $2) }
115 | decl comment ID CN term
116 { Some (T.Entity ($1, $3, $2, $5)) }
117 | def comment ID EQ term
118 { Some (T.Entity ($1, $3, $2, $5)) }
119 | def comment ID EQ term CN term
120 { Some (T.Entity ($1, $3, $2, T.Cast ($7, $5))) }
122 { Some (T.Section (Some $2)) }
124 { Some (T.Section None) }
126 { Some (T.Sorts $2) }
131 | GRAPH {} | decl {} | def {}
132 | OPEN {} | CLOSE {} | SORTS {} | EOF {}
135 | xentity { $1, false }
136 | xentity start { $1, true }