- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 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
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
#include <ctype.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MEM 100
#define READ 10
#define WRITE 11
#define LOAD 20
#define STORE 21
#define ADD 30
#define SUBSTRACT 31
#define DIVIDE 32
#define MUL 33
#define BRANCH 40
#define BRANCHNEG 41
#define BRANCHZERO 42
#define HALT 43
int count_down = 99;
struct stackNode_2 {
int data;
struct stackNode_2 *nextPtr;
};
typedef struct stackNode_2 StackNode_2;
typedef StackNode_2 *StackNodePtr_2;
typedef struct tableEntry {
char symbol[10];
char type;
int location;
} data;
int my_isdigit(char alpha);
int my_isalpha(char alpha);
int isOperator_2(char c);
char stackTop_1(StackNodePtr_2 topPtr);
int helper_search_1(data *base, char *token, int run);
int helper_search_2(data *base, char *token, int run);
int (*helper_search[2])(data *base, char *token, int run) = {helper_search_1,
helper_search_2};
int search_in_base(data *intro_search, char *str_tok_search);
int helper_search_base(data *base, char *token, int run);
void convertToPostfix_1(char infix[], char postfix[]);
int pop_2(StackNodePtr_2 *topPtr);
void push_2(StackNodePtr_2 *topPtr, int info);
int isEmpty_2(StackNodePtr_2 topPtr);
int precedence_1(char operator1, char operator2);
void convertToPostfix_1(char infix[], char postfix[]) {
int i = 0, j = 0;
char c;
/* Push left parenthesis to stack */
StackNodePtr_2 stackPtr = NULL;
push_2(&stackPtr, '(');
/* Add right parenthesis to end of infix */
while (infix[i] != '\0')
i++;
infix[i++] = ')';
infix[i] = '\0';
i = 0;
Комментарии (0) RSS
Добавить комментарий