Rev 10 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 10 | Rev 8136 | ||
---|---|---|---|
Line 13... | Line 13... | ||
13 | * You should have received a copy of the GNU General Public License |
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 |
14 | * along with this program; if not, write to the Free Software |
15 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
15 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
16 | */ |
16 | */ |
17 | 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 |
|
18 | #include "mathexp.h" |
24 | }; |
- | |
25 | 19 | ||
26 | char *typenames[]={ |
20 | char *typenames[]={ |
27 | "number", "variable", |
21 | "number", "variable", |
28 | "parentheses","matrix","set","function", |
22 | "parentheses","matrix","set","function", |
29 | "exponentiation","term","cupcap","addition", |
23 | "exponentiation","term","cupcap","addition", |
30 | "equation","inequality","not","and","or","implication", |
24 | "equation","inequality","not","and","or","implication", |
31 | "comma","quantifier" |
25 | "comma","quantifier" |
32 | }; |
26 | }; |
33 | - | ||
34 | typedef struct op { |
- | |
35 | char *name; |
- | |
36 | int lvl; |
- | |
37 | } op; |
- | |
38 | 27 | ||
39 |
|
28 | op oppunct[]={ |
40 | {"(", exp_paren}, |
29 | {"(", exp_paren}, |
41 | {"[", exp_matrix}, |
30 | {"[", exp_matrix}, |
42 | {"{", exp_set}, |
31 | {"{", exp_set}, |
43 | {"^", exp_exp}, |
32 | {"^", exp_exp}, |
44 | {"**", exp_exp}, |
33 | {"**", exp_exp}, |
Line 60... | Line 49... | ||
60 | {"==", exp_eq}, |
49 | {"==", exp_eq}, |
61 | {"=", exp_eq}, |
50 | {"=", exp_eq}, |
62 | {",", exp_comma}, |
51 | {",", exp_comma}, |
63 | {";", exp_comma}, |
52 | {";", exp_comma}, |
64 | }; |
53 | }; |
65 |
|
54 | int oppunctno=(sizeof(oppunct)/sizeof(oppunct[0])); |
66 | 55 | ||
67 |
|
56 | op opalpha[]={ |
68 | {"cup", exp_cupcap}, |
57 | {"cup", exp_cupcap}, |
69 | {"cap", exp_cupcap}, |
58 | {"cap", exp_cupcap}, |
70 | {"and", exp_and}, |
59 | {"and", exp_and}, |
71 | {"or", exp_or}, |
60 | {"or", exp_or}, |
72 | {"not", exp_not}, |
61 | {"not", exp_not}, |
73 | {"in", exp_quantifier}, |
62 | {"in", exp_quantifier}, |
74 | {"forall", exp_quantifier}, |
63 | {"forall", exp_quantifier}, |
75 | {"exist", exp_quantifier}, |
64 | {"exist", exp_quantifier}, |
76 | {"exists", exp_quantifier}, |
65 | {"exists", exp_quantifier}, |
77 | }; |
66 | }; |
78 |
|
67 | int opalphano=(sizeof(opalpha)/sizeof(opalpha[0])); |
79 | 68 | ||
80 | struct { |
- | |
81 | char *name; |
- | |
82 | int lvl1, lvl2; |
- | |
83 |
|
69 | ex exptype[]={ |
84 | {"addition", exp_add, exp_add}, |
70 | {"addition", exp_add, exp_add}, |
85 | {"algexp", 0, exp_add}, |
71 | {"algexp", 0, exp_add}, |
86 | {"and", exp_and, exp_and}, |
72 | {"and", exp_and, exp_and}, |
87 | {"andor", exp_and, exp_or}, |
73 | {"andor", exp_and, exp_or}, |
88 | {"equation", exp_eq, exp_eq}, |
74 | {"equation", exp_eq, exp_eq}, |
Line 104... | Line 90... | ||
104 | {"set", exp_set, exp_set}, |
90 | {"set", exp_set, exp_set}, |
105 | {"term", 0, exp_muldiv}, |
91 | {"term", 0, exp_muldiv}, |
106 | {"variable", exp_variable, exp_variable}, |
92 | {"variable", exp_variable, exp_variable}, |
107 | {"variables", exp_variable, exp_variable}, |
93 | {"variables", exp_variable, exp_variable}, |
108 | }; |
94 | }; |
- | 95 | ||
109 |
|
96 | int exptypeno=(sizeof(exptype)/sizeof(exptype[0])); |
110 | 97 |