Professional Documents
Culture Documents
Untitled
Untitled
h>
#include<string.h>
struct MOTtable
{
char Mnemonic[6];
int Class;
char Opcode[3];
};
struct symboltable
{
char Symbol[8];
int Address;
int Size;
}ST[20];
struct literaltable
{
int Literal;
int Address;
}LT[10];
int PT[20];
struct intermediatecode
{
int LC;
int Code1,Type1;
int Code2,Type2;
int Code3,Type3;
}IC[30];
int
int
int
int
int
LC=0;
iPT;
iLT=0;
iST=0;
iIC=0;
//Location
//Index of
//Index of
//Index of
//Index of
counter
next entry
next entry
next entry
next entry
in
in
in
in
Poll Table
Literal Table
Symbol Table
intemediate code table
void main()
{
char file1[40],nextline[80];
char code1[5],code2[5],code3[5],code4[5],code5[5],code6[5];
int len,i,j,temp,errortype,count;
FILE *ptr1;
printf("\nEnter Symbol Table Entries : ");
printf("\nEnter No. entries : ");
scanf("%d",&count);
iST=count;
for(i=0;i<count;i++)
{
printf("\nEnter the address of the symbol : ");
scanf("%d",&(ST[i].Address));
}
printf("\nEnter Literal Table Entries : ");
printf("\nEnter No. entries : ");
scanf("%d",&count);
iLT=count;
for(i=0;i<count;i++)
{
printf("\nEnter the address of the literal : ");
scanf("%d",&(LT[i].Address));
}
{
printf("00 00 %3s",code4);
LC=LC+1;
}
}
}
}
/* Input / Output
Enter Symbol Table Entries :
Enter No. entries : 4
Enter the address of the symbol : 101
Enter the address of the symbol : 132
Enter the address of the symbol : 103
Enter the address of the symbol : 112
Enter Literal Table Entries :
Enter No. entries : 1
Enter the address of the literal : 108
enter Source file name(containing Intermediate Code):ic.ic
100)
101)
102)
103)
104)
105)
106)
107)
108)
109)
110)
111)
112)
132)
09
04
05
03
04
06
07
05
00
10
00
00
02
02
02
03
03
04
02
00
00
00
101
108
132
132
132
101
103
112
1
112
000