## IMPLEMENTATION OF CALCULATOR USING LEX AND YACC

Lex %{ #include"y.tab.h" #include %} %% ([0-9]+|([0-9]*.[0-9]+)([eE][-+]?[0-9]+)?) {yylval.dval=atof(yytext);return NUMBER;} log | LOG {return LOG;} In {return nLOG;} sin | SIN {return SINE;} cos | COS {return COS;} tan | TAN…

## Program to Convert the BNF rules into Yacc form and write code to generate Abstract Syntax Tree

ALGORITHM:1. Start 2. Include the header file.3. In int code.l,declare the variable lie no as integer and assign it to be equal to ‘1’.4. Start the int code.l with declarative section.5.…

## C program to Implement any one storage allocation strategies

//Implement any one storage allocation strategies (Heap,Stack,Static) #include #include #include #define TRUE 1 #define FALSE 0 typedef struct Heap { int data; struct Heap *next; }node; node *create(); void main()…

## C program to implement Code Optimization Techniques

ALGORITHM: Input: Set of ‘L’ values with corresponding ‘R’ values. Output: Intermediate code & Optimized code after eliminating common expressions. //C program to implement Code Optimization Techniques. #include #include #include struct op…

## C program to find the FIRST of a given grammer

#include #include void FIRST(char[],char ); void result(char[],char); int nop; char prod[10][10]; void main() { int i; char choice; char c; char res1[20]; clrscr(); printf("How many number of productions ? :");…

## C program to arrange a list of integers in ascending order using Insertion sort

INSERTION SORTStart with an empty left hand [sorted array] and the cards face down on the table [unsorted array].Then remove one card [key] at a time from the table [unsorted…

## C program for creating and traversing the binary search tree of characters

/*program for creating and traversing the binary search tree*/ #include #include typedef struct BST { char d; /*declaring a structure to create a node*/ struct BST *lc,*rc; }node; void insert(node…

## C program to implement double ended queue ADT using doubly linked list

//program to implement double ended queue adt using doubly linked list #include #include /*declaring a structure to create a node*/ struct node { int data; struct node *prev, *next; };…

## C Program to implement a double ended queue ADT using arrays

//Programs to implement a double ended queue ADT using arrays #include #define SIZE 30 int dequeue[SIZE]; int front=-1,rear=-1; /* initializing front and rear*/ void insertrear(int); void deletefront(); void insertfront(int); void…

## C program to create a single linked list & delete the contents and display the contents

#include #include #include #include /*declaring a structure to create a node*/ struct node { int data; struct node *next; }; struct node *start; /* inserting nodes into the list*/ /*function…