Borrador

Solo disponible en BuenasTareas
  • Páginas : 8 (1766 palabras )
  • Descarga(s) : 0
  • Publicado : 10 de septiembre de 2010
Leer documento completo
Vista previa del texto
# include<stdio.h>
# include<iostream.h>
# include<io.h>
# include<string.h>
# include<ctype.h>
# include<conio.h>

void aceptacion(int e);
void error(int e);
int busca_columna(char c);
void lexico();
void menu();
void acep();
void error();
int comp(char *c);
int comp2(char *c);
int buf_doble(int a);


int edo,col;
char cad,bufer[1002];FILE *fp,*fe,*fa;

int mat [21][28]={{1,20,6,8,4,201,10,17,13,201,14,15,16,112,113,114,18,201,19,201,119,121,124,125,0,0,0,200},
{1,2,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100},
{3,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202},{3,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101},
{4,102,102,102,4,5,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102},
{4,203,203,203,4,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203},
{6,6,7,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,204},{103,6,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103},
{8,8,8,9,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,204},
{103,103,103,8,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103},
{104,104,104,104,104,104,104,11,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104},{11,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,205},
{11,11,11,11,11,11,105,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,205},
{13,13,13,13,13,13,13,13,13,105,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,205},
{122,122,122,122,122,122,122,122,122,122,122,122,122,106,122,122,122,122,122,122,122,122,122,122,122,122,122,122},{109,109,109,109,109,109,109,109,109,109,109,109,107,108,109,109,109,109,109,109,109,109,109,109,109,109,109},
{110,110,110,110,110,110,110,110,110,110,110,110,110,111,110,110,110,110,110,110,110,110,110,110,110,110,110},
{115,115,115,115,115,115,115,116,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115},{18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,206,117,18,18,18,18,18,18,18,18,18,207},
{19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,206,118,19,19,19,19,19,19,19},
{120,123,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120}};

char res[39][10] ={"ARRAY","ELSE","FOR","EXIT","REPEAT","TO","TRUE",
"CHAR","BEGIN","WRITELN","IF","NOT","RETURN","UNTIL","FALSE","STRING","CASE","READLN","LOOP","OF","PROCEDURE",
"VAR","DIV","BYTE","CONST","ELSEIF","MODULE","MOD",
"BY","WHILE","INTEGER","BOOLEAN","DO","END","FUNCTION",
"RECORD","THEN","WITH","REAL"};

char log[3][4] = {"AND","OR","NOT"};

void main()
{
char *archivo;
clrscr();
edo=0;
cout<<"Indique la ruta y el nombres del archivo ";
cin>>archivo;if((fp=fopen(archivo,"rt"))==NULL){
fclose(fp);
cout<<"Nombre de archivo no valido" ;
getch();
}
else{
lexico();
menu();
}
}


void aceptacion(int e)
{
switch(e)
{
case 100:printf(" CONSTANTE ENTERAn");
break;
case 101:printf(" CONSTANTE REALn");
break;
case 102:printf(" IDENTIFICADOR n");
break;
case 103:printf(" LETRERO ( ' O '' )n");break;
case 104:printf(" OPERADOR ARITMETICO DE DIVISION ( / )n");
break;
case 105:printf(" COMENTARIOSn");
break;
case 106:printf(" OPERADOR RELACIONAL DE ASIGNACION ( := )n");
break;
case 107:printf(" OPERADOR RELACIONAL DIFERENTE ( <> )n");
break;
case 108:printf(" OPERADOR RELACIONAL MENOR O IGUAL ( <= )n");
break;...
tracking img