Back to index

wims  3.65+svn20090927
tables.c
Go to the documentation of this file.
00001 /*    Copyright (C) 2002-2003 XIAO, Gang of Universite de Nice - Sophia Antipolis
00002  *
00003  *  This program is free software; you can redistribute it and/or modify
00004  *  it under the terms of the GNU General Public License as published by
00005  *  the Free Software Foundation; either version 2 of the License, or
00006  *  (at your option) any later version.
00007  *
00008  *  This program is distributed in the hope that it will be useful,
00009  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011  *  GNU General Public License for more details.
00012  *
00013  *  You should have received a copy of the GNU General Public License
00014  *  along with this program; if not, write to the Free Software
00015  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00016  */
00017 
00018 enum{
00019     exp_number, exp_variable,
00020     exp_paren, exp_matrix, exp_set, exp_fn, 
00021     exp_exp, exp_muldiv, exp_cupcap, exp_add,
00022     exp_eq, exp_ineq, exp_not, exp_and, exp_or, exp_imply,
00023     exp_comma, exp_quantifier
00024 };
00025 
00026 char *typenames[]={
00027     "number", "variable",
00028       "parentheses","matrix","set","function",
00029       "exponentiation","term","cupcap","addition",
00030       "equation","inequality","not","and","or","implication",
00031       "comma","quantifier"
00032 };
00033 
00034 typedef struct op {
00035     char *name;
00036     int lvl;
00037 } op;
00038 
00039 struct op oppunct[]={
00040     {"(",     exp_paren},
00041     {"[",     exp_matrix},
00042     {"{",     exp_set},
00043     {"^",     exp_exp},
00044     {"**",    exp_exp},
00045     {"*",     exp_muldiv},
00046     {"/",     exp_muldiv},
00047     {"-",     exp_add},
00048     {"+",     exp_add},
00049     {"!=",    exp_eq},
00050     {"<>",    exp_eq},
00051     {"<==>",  exp_imply},
00052     {"<==",   exp_imply},
00053     {"<=>",   exp_imply},
00054     {"=>",    exp_imply},
00055     {"==>",   exp_imply},
00056     {"<=",    exp_ineq},
00057     {">=",    exp_ineq},
00058     {"<",     exp_ineq},
00059     {">",     exp_ineq},
00060     {"==",    exp_eq},
00061     {"=",     exp_eq},
00062     {",",     exp_comma},
00063     {";",     exp_comma},
00064 };
00065 #define oppunctno (sizeof(oppunct)/sizeof(oppunct[0]))
00066 
00067 struct op opalpha[]={
00068     {"cup",   exp_cupcap},
00069     {"cap",   exp_cupcap},
00070     {"and",   exp_and},
00071     {"or",    exp_or},
00072     {"not",   exp_not},
00073     {"in",    exp_quantifier},
00074     {"forall",       exp_quantifier},
00075     {"exist", exp_quantifier},
00076     {"exists",       exp_quantifier},
00077 };
00078 #define opalphano (sizeof(opalpha)/sizeof(opalpha[0]))
00079 
00080 struct {
00081     char *name;
00082     int lvl1, lvl2;
00083 } exptype[]={
00084        {"addition",  exp_add, exp_add},
00085        {"algexp",    0, exp_add},
00086         {"and",             exp_and, exp_and},
00087         {"andor",    exp_and, exp_or},
00088        {"equation",  exp_eq, exp_eq},
00089        {"equations", exp_eq, exp_eq},
00090        {"function",  exp_fn, exp_fn},
00091        {"functions", exp_fn, exp_fn},
00092        {"inequalities",exp_ineq, exp_ineq},
00093        {"inequality",       exp_ineq, exp_ineq},
00094        {"inequation",       exp_eq, exp_ineq},
00095        {"inequations",      exp_eq, exp_ineq},
00096         {"logic",    exp_not, exp_or},
00097         {"matrix",   exp_matrix, exp_matrix},
00098         {"mult",     exp_muldiv, exp_muldiv},
00099         {"multiplication", exp_muldiv, exp_muldiv},
00100         {"or",              exp_or, exp_or},
00101         {"parentheses",     exp_paren, exp_paren},
00102         {"parenthesis",     exp_paren, exp_paren},
00103         {"predicate",       exp_eq, exp_quantifier},
00104         {"set",             exp_set, exp_set},
00105         {"term",     0, exp_muldiv},
00106         {"variable", exp_variable, exp_variable},
00107         {"variables",       exp_variable, exp_variable},
00108 };
00109 #define exptypeno (sizeof(exptype)/sizeof(exptype[0]))
00110