/* Copyright (C) 2000, HELM Team. * * This file is part of HELM, an Hypertextual, Electronic * Library of Mathematics, developed at the Computer Science * Department, University of Bologna, Italy. * * HELM is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * HELM is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with HELM; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. * * For details, see the HELM World-Wide-Web page, * http://cs.unibo.it/helm/. */ /* AUTOR: Ferruccio Guidi */ %{ let f (x, y, z) = x let s (x, y, z) = y let t (x, y, z) = z let builtin s = let ns = "http://www.cs.unibo.it/helm/schemas/schema-helm#" in match s with | "MH" -> ns ^ "MainHypothesis" | "IH" -> ns ^ "InHypothesis" | "MC" -> ns ^ "MainConclusion" | "IC" -> ns ^ "InConclusion" | "IB" -> ns ^ "InBody" | "SET" -> "Set" | "PROP" -> "Prop" | "TYPE" -> "Type" | _ -> raise Parsing.Parse_error module G = MQueryGenerator %} %token ID %token CONURI %token VARURI %token INDTYURI %token INDCONURI %token ALIAS EOF %start interp %type CicTextualParser0.interpretation_codomain_item option> interp %token STR %token DL DQ LC RC CM %token MOBJ MSORT MREL OOBJ OSORT OREL UNIV %start qstr specs %type qstr %type specs %% uri: | CONURI { CicTextualParser0.ConUri $1 } | VARURI { CicTextualParser0.VarUri $1 } | INDTYURI { CicTextualParser0.IndTyUri ((fst $1), (snd $1)) } | INDCONURI { CicTextualParser0.IndConUri ((f $1), (s $1), (t $1)) } ; alias: | ALIAS ID uri { ($2, CicTextualParser0.Uri $3) } ; aliases: | alias aliases { $1 :: $2 } | EOF { [] } ; interp: | aliases { function CicTextualParser0.Id s -> (try Some (List.assoc s $1) with Not_found -> None) | _ -> None } ; qstr: | DQ { "" } | STR qstr { $1 ^ $2 } ; str: | STR { $1 } | DL ID { builtin $2 } ; strs: | str CM strs { $1 :: $3 } | str { [$1] } | { [] } ; list: | LC strs RC { $2 } ; spec: | MOBJ list list list { G.MustObj ($2, $3, $4) } | MSORT list list list { G.MustSort ($2, $3, $4) } | MREL list list { G.MustRel ($2, $3) } | OOBJ list list list { G.OnlyObj ($2, $3, $4) } | OSORT list list list { G.OnlySort ($2, $3, $4) } | OREL list list { G.OnlyRel ($2, $3) } | UNIV list { G.Universe $2 } ; specs: | spec specs { $1 :: $2 } | EOF { [] } ;