#pragma once

//#ifndef __EVAL_H
//#define __EVAL_H

#ifdef __WATCOMC__
#pragma library("misc.lib")
#endif

#ifdef __cplusplus
extern "C" {
#endif
//---------------------------------------------------------------------------//

#define VAL 1
#define OPR 2
#define VAR 3
#define FUN 4


#define ERR_BASE  1
#define ERR_OP      2
#define ERR_PARSE 3
#define ERR_CHAR  4
#define ERR_TYPE  5


typedef struct s_TREE TREE;


struct s_TREE
{
  char opr;
  int type;
  double value;
  TREE *left,*right;
};

void dispose_tree (TREE *);
TREE *expr (char **);
TREE *term (char **);
TREE *factor (char **);
double evaltree (TREE *);
double eval_string (char *);

//---------------------------------------------------------------------------//
#ifdef __cplusplus
}
#endif
//#endif
