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 OPEN CLOSE GLOBAL EOF
39 %type <Txt.entity option * bool> entry
55 | ID CM ids { $1 :: $3 }
59 | ID CN term { $1, $3 }
62 | ID EQ term { $1, $3 }
66 | abst CM absts { $1 :: $3 }
70 | abbr CM abbrs { $1 :: $3 }
78 | STAR IX { T.Sort $2 }
79 | STAR ID { T.NSrt $2 }
80 | hash IX { T.LRef ($2, 0) }
81 | hash IX PLUS IX { T.LRef ($2, $4) }
82 | hash ID { T.NRef $2 }
86 | OA term CA fs term { T.Cast ($2, $5) }
87 | OP terms CP fs term { T.Appl ($2, $5) }
88 | atom OP terms CP { T.Appl (List.rev $3, $1) }
89 | OB binder CB fs term { T.Bind ($2, $5) }
93 | term CM terms { $1 :: $3 }
96 start: OPEN {} | CLOSE {} | GLOBAL {} | EOF {} ;
98 | OPEN ID { Some (T.Section (Some $2)) }
99 | CLOSE { Some (T.Section None) }
100 | GLOBAL comment ID CN term { Some (T.Global (false, $3, $2, $5)) }
101 | GLOBAL comment ID EQ term { Some (T.Global (true, $3, $2, $5)) }
102 | GLOBAL comment ID EQ term CN term { Some (T.Global (true, $3, $2, T.Cast ($7, $5))) }
106 | xentity { $1, false }
107 | xentity start { $1, true }