-
Notifications
You must be signed in to change notification settings - Fork 0
/
eval_upmc.h
68 lines (39 loc) · 1.04 KB
/
eval_upmc.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//
// eval_upmc.h
// SashProject
//
// Created by Amer Nasser on 25/11/13.
// Copyright (c) 2013 ____. All rights reserved.
//
#ifndef SashProject_eval_upmc_h
#define SashProject_eval_upmc_h
typedef union {
int terminal;
struct expression* expr[2];
} Data;
typedef struct expression {
char op;
Data data;
} Expr;
/*
typedef struct {
const char *str;
int len;
int pos;
jmp_buf err_jmp_buf;
const char *error;
void *user_data;
parser_variable_callback variable_cb;
parser_function_callback function_cb;
} parser_data;*/
char* getExpression(char* arg);
void error_message(const char* string) ;
char eat_char(const char* string, char c) ;
int eat_int(const char* string) ;
Expr* factor(const char* string, Expr* expr) ;
Expr* factor_tail(const char* string, Expr* expr) ;
Expr* term(const char* string, Expr* expr) ;
Expr* term_tail(const char* string, Expr* expr) ;
Expr* parse(const char* string) ;
int eval(Expr* expr) ;
#endif