#include "stdio.h"
struct token
{int id;
char value[10];
}tokens[4000];
struct token tokensid[34]={{1,"and"},{2,"array"},{3,"begin"},{4,"bool"},
{5,"call"},{6,"case"},{7,"char"},{8,"constant"},{9,"do"},{10,"else"},{11,"end"},
{12,"false"},{13,"for"},{14,"if"},{15,"input"},{16,"integer"},{17,"not"},
{18,"of"},{19,"or"},{20,"output"},{21,"procedure"},{22,"program"},{23,"read"},
{24,"real"},{25,"repeat"},{26,"set"},{27,"then"},{28,"to"},{29,"true"},
{30,"until"},{31,"var"},{32,"while"},{33,"write"}};
struct token single[10]={{38,"'"},{39,"("},{40,")"},{43,"+"},{44,","},{45,"-"},
{46,"`"},{56,"="},{59,"["},{60,"]"}};
int length;
char *source;
FILE *fout;
int index,tokenindex;
int line;
int errorindex;
int equals(char dss[10],int len)
{
int k,j;
int fla;
for(k=0;k<33;k++)
{fla=1;
for(j=0;j<len;j++)
{if(tokensid[k].value[j]!=dss[j])
fla=0;}
if(fla==1&&tokensid[k].value[j]=='\0')
{return tokensid[k].id;