Autómata finito determinismo
#include
#include
#include
#include
//definimos las constantes
#define AFN_MAX 11
#define EPSILON -1
#define ACEPTA -2
#defineSTACKSIZE 100
#define MAXIMO 80
//enum bool {FALSE,TRUE};
struct stack {
int top;
int items[STACKSIZE];
};
typedef stack*STACKPTR;
bool empty(STACKPTR ps);//funcion si la pila esta vacia
int pop(STACKPTR ps);
void push(STACKPTR ps,int x);
void init(STACKPTR ps);void e_clausura(int* ,int,int* ,int &na);
void mover(int *,int,int* t,int &m,int c);
void print(int* t,int m,char c);
void copy(int*,int,intestadosD[][AFN_MAX],int &nest,int*);
bool no_marcado(int*,int,int estadosD[AFN_MAX][AFN_MAX],int nest);
void aceptacion();
void print_estadosD(intestadosD[][AFN_MAX],int nest,int nD[]);
// 0 1 2 3 4 5 6 7 8 9 10
int aristas[][AFN_MAX]={
0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0,
0,0, -1, 0, -1, 0, 0, 0, 0, 0, 0,
0, 0, 0,'a', 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0,
0, 0, 0, 0, 0,'b', 0, 0, 0,0, 0,
0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0,
0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,'a', 0, 0,
0, 0, 0, 0, 0,0, 0, 0, 0, 'b', 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'b',
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2
};
void main(){// afnafd.cpp
intm,i,j,k;
int t[AFN_MAX];
int estadosD[AFN_MAX][AFN_MAX],nest=0;
int nD[AFN_MAX];
int a[AFN_MAX],na;
char* alfabeto="ab";
clrscr();
*t=0;m=1;
cout
Regístrate para leer el documento completo.