Lab4 D
Lab4 D
Code in C -
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
return precedenceTable[getPrecedenceIndex(topOfStack)][getPrecedenceIndex(inputSymbol)]
== relation;
}
int main() {
char grammar[20][20];
int numOfRules;
char expression[100];
printf("Enter the Arithmetic Expression End with $: ");
scanf("%s", expression);
showShift(expression[inputPointer]);
pushToStack(expression[inputPointer]);
inputPointer++;
} else if (checkPrecedence(stack[stackTop], expression[inputPointer], '>')) {
do {
tempStack[++tempTop] = popFromStack();
showReduce(tempStack[tempTop]);
} while (!checkPrecedence(stack[stackTop], tempStack[tempTop], '<'));
}
}
return 0;
}