Subversion Repositories wimsdev

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. /*    Copyright (C) 2002-2003 XIAO, Gang of Universite de Nice - Sophia Antipolis
  2.  *
  3.  *  This program is free software; you can redistribute it and/or modify
  4.  *  it under the terms of the GNU General Public License as published by
  5.  *  the Free Software Foundation; either version 2 of the License, or
  6.  *  (at your option) any later version.
  7.  *
  8.  *  This program is distributed in the hope that it will be useful,
  9.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11.  *  GNU General Public License for more details.
  12.  *
  13.  *  You should have received a copy of the GNU General Public License
  14.  *  along with this program; if not, write to the Free Software
  15.  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16.  */
  17.  
  18. enum{
  19.     exp_number, exp_variable,
  20.     exp_paren, exp_matrix, exp_set, exp_fn,
  21.     exp_exp, exp_muldiv, exp_cupcap, exp_add,
  22.     exp_eq, exp_ineq, exp_not, exp_and, exp_or, exp_imply,
  23.     exp_comma, exp_quantifier
  24. };
  25.  
  26. char *typenames[]={
  27.     "number", "variable",
  28.       "parentheses","matrix","set","function",
  29.       "exponentiation","term","cupcap","addition",
  30.       "equation","inequality","not","and","or","implication",
  31.       "comma","quantifier"
  32. };
  33.  
  34. typedef struct op {
  35.     char *name;
  36.     int lvl;
  37. } op;
  38.  
  39. struct op oppunct[]={
  40.     {"(",       exp_paren},
  41.     {"[",       exp_matrix},
  42.     {"{",       exp_set},
  43.     {"^",       exp_exp},
  44.     {"**",      exp_exp},
  45.     {"*",       exp_muldiv},
  46.     {"/",       exp_muldiv},
  47.     {"-",       exp_add},
  48.     {"+",       exp_add},
  49.     {"!=",      exp_eq},
  50.     {"<>",      exp_eq},
  51.     {"<==>",    exp_imply},
  52.     {"<==",     exp_imply},
  53.     {"<=>",     exp_imply},
  54.     {"=>",      exp_imply},
  55.     {"==>",     exp_imply},
  56.     {"<=",      exp_ineq},
  57.     {">=",      exp_ineq},
  58.     {"<",       exp_ineq},
  59.     {">",       exp_ineq},
  60.     {"==",      exp_eq},
  61.     {"=",       exp_eq},
  62.     {",",       exp_comma},
  63.     {";",       exp_comma},
  64. };
  65. #define oppunctno (sizeof(oppunct)/sizeof(oppunct[0]))
  66.  
  67. struct op opalpha[]={
  68.     {"cup",     exp_cupcap},
  69.     {"cap",     exp_cupcap},
  70.     {"and",     exp_and},
  71.     {"or",      exp_or},
  72.     {"not",     exp_not},
  73.     {"in",      exp_quantifier},
  74.     {"forall",  exp_quantifier},
  75.     {"exist",   exp_quantifier},
  76.     {"exists",  exp_quantifier},
  77. };
  78. #define opalphano (sizeof(opalpha)/sizeof(opalpha[0]))
  79.  
  80. struct {
  81.     char *name;
  82.     int lvl1, lvl2;
  83. } exptype[]={
  84.         {"addition",    exp_add, exp_add},
  85.         {"algexp",      0, exp_add},
  86.         {"and",         exp_and, exp_and},
  87.         {"andor",       exp_and, exp_or},
  88.         {"equation",    exp_eq, exp_eq},
  89.         {"equations",   exp_eq, exp_eq},
  90.         {"function",    exp_fn, exp_fn},
  91.         {"functions",   exp_fn, exp_fn},
  92.         {"inequalities",exp_ineq, exp_ineq},
  93.         {"inequality",  exp_ineq, exp_ineq},
  94.         {"inequation",  exp_eq, exp_ineq},
  95.         {"inequations", exp_eq, exp_ineq},
  96.         {"logic",       exp_not, exp_or},
  97.         {"matrix",      exp_matrix, exp_matrix},
  98.         {"mult",        exp_muldiv, exp_muldiv},
  99.         {"multiplication", exp_muldiv, exp_muldiv},
  100.         {"or",          exp_or, exp_or},
  101.         {"parentheses", exp_paren, exp_paren},
  102.         {"parenthesis", exp_paren, exp_paren},
  103.         {"predicate",   exp_eq, exp_quantifier},
  104.         {"set",         exp_set, exp_set},
  105.         {"term",        0, exp_muldiv},
  106.         {"variable",    exp_variable, exp_variable},
  107.         {"variables",   exp_variable, exp_variable},
  108. };
  109. #define exptypeno (sizeof(exptype)/sizeof(exptype[0]))
  110.  
  111.