add Fibonacci sequence
[calc.git] / parser.h
index 26022e5e585a469c67b824484a86912be28bf5f4..734d818f173f4bc1a1ca39ac01de405c804df77a 100644 (file)
--- a/parser.h
+++ b/parser.h
@@ -1,6 +1,10 @@
 #ifndef __PARSER_H__
 #define __PARSER_H__
 
+/* global variables */
+
+extern double answer;
+
 /* function type */
 
 typedef enum {
@@ -8,9 +12,14 @@ typedef enum {
     Add, Sub,
     Mul, Div, Mod,
     Pow, Sqr,
-    Cos, Sin, Atn,
+    Cos, Sin, Atan,
     Log, Exp,
-    Qui, Hel
+    Store, Recall, Inc, Dec, Disp,
+    Quit, Help,
+    Ans, E, Pi,
+    Equal, Diff, Ge, Le, Gt, Lt,
+    And, Or, Not,
+    Cond, While, Prog
 } func_t;
 
 /* keyword type */
@@ -20,17 +29,16 @@ typedef struct _keyword_t {
     func_t func;
     int nbops;
     int offset;
-    int prio;
+    float prio;
 } keyword_t;
 
 /* calculus element type */
 
-#define MAX_OPERANDS 10
 typedef struct _element_t {
     func_t func;
     int nbops;
-    struct _element_t *ops[MAX_OPERANDS];
-    float value;
+    struct _element_t **ops;
+    double value;
     int prio;
 } element_t;
 
@@ -38,6 +46,8 @@ typedef struct _element_t {
 
 /* parser function */
 
+void delelement (element_t *root);
+
 element_t *parser (char *str, char **next, int prio);
 
 void print_element (element_t *root, int level);