Programa 1
%{
#include <stdio.h>
#include <conio.h>
%}
%option noyywrap
alfa [a-d]
L ab
%%
"bye" {bye();return 0;}
{L} {printf("Si pertenece al Lenguaje : %s", yytext);}
{alfa}*|^L {printf("No pertenece al Lenguaje : %s", yytext);}
. printf("%s",yytext[0]);
%%
main(){
printf("Programa que reconoce la e.r ab\nIngrese letras del rango [a-d]\nIngrese bye para salir\n"); yylex();
}
bye()
{ printf("Fin del programa\n"); }
----------------------------------------------------------------------------------------------------------------------
Programa 2
%{
#include <stdio.h>
#include <conio.h>
%}
%option noyywrap
alfa [a-d]
L a|b
%%
"bye" {bye();return 0;}
{L} {printf("Si pertenece al Lenguaje : %s", yytext);}
{alfa}*|^L {printf("No pertenece al Lenguaje : %s", yytext);}
. printf("%s",yytext[0]);
%%
main(){
printf("Programa que reconoce la e.r a|b\nIngrese letras del rango [a-d]\nIngrese bye para salir\n"); yylex();
}
bye()
{ printf("Fin del programa\n"); }
-----------------------------------------------------------------------------------------------
Programa 3
%{
#include <stdio.h>
#include <conio.h>
%}
%option noyywrap
alfa [a-d]
L a*
%%
"bye" {bye();return 0;}
{L}|" " {printf("Si pertenece al Lenguaje : %s", yytext);}
{alfa}*|^L {printf("No pertenece al Lenguaje : %s", yytext);}
. printf("%s",yytext[0]);
%%
main(){
printf("Programa que reconoce la e.r a*\nIngrese letras del rango [a-d]\nIngrese bye para salir\n"); yylex();
}
bye()
{ printf("Fin del programa\n"); }
----------------------------------------------------------------
Programa 4
%{
#include <stdio.h>
#include <conio.h>
%}
%option noyywrap
alfa [a-d]
L ab*
%%
"bye" {bye();return 0;}
{L} {printf("Si pertenece al Lenguaje : %s", yytext);}
{alfa}*|^L {printf("No pertenece al Lenguaje : %s", yytext);}
. printf("%s",yytext[0]);
%%
main(){
printf("Programa que reconoce la e.r ab*\nIngrese letras del rango [a-d]\nIngrese bye para salir\n"); yylex();
}
bye()
{ printf("Fin del programa\n"); }
--------------------------------------------------------------------------------------------------
Programa 5
%{
#include <stdio.h>
#include <conio.h>
%}
%option noyywrap
alfa [a-d]
L (ab|c)*d
%%
"bye" {bye();return 0;}
{L} {printf("Si pertenece al Lenguaje : %s", yytext);}
{alfa}*|^L {printf("No pertenece al Lenguaje : %s", yytext);}
. printf("%s",yytext[0]);
%%
main(){
printf("Programa que reconoce la e.r (ab|c)*d\nIngrese letras del rango [a-d]\nIngrese bye para salir\n"); yylex();
}
bye()
{ printf("Fin del programa\n"); }
--------------------------------------------------------------------------------------------
Programa 6
%{
#include <stdio.h>
#include <conio.h>
%}
%option noyywrap
alfa [a-d]
L (ab)*
%%
"bye" {bye();return 0;}
{L}|" " {printf("Si pertenece al Lenguaje : %s", yytext);}
{alfa}*|^L {printf("No pertenece al Lenguaje : %s", yytext);}
. printf("%s",yytext[0]);
%%
main(){
printf("Programa que reconoce la e.r (ab)*\nIngrese letras del rango [a-d]\nIngrese bye para salir\n"); yylex();
}
bye()
{ printf("Fin del programa\n"); }
-----------------------------------------------------------------------------------------------
Programa 7
%{
#include <stdio.h>
#include <conio.h>
%}
%option noyywrap
alfa [a-d]
L a|a*b
%%
"bye" {bye();return 0;}
{L} {printf("Si pertenece al Lenguaje : %s", yytext);}
{alfa}*|^L {printf("No pertenece al Lenguaje : %s", yytext);}
. printf("%s",yytext[0]);
%%
main(){
printf("Programa que reconoce la e.r a|a*b\nIngrese letras del rango [a-d]\nIngrese bye para salir\n"); yylex();
}
bye()
{ printf("Fin del programa\n"); }
-----------------------------------------------------------------------------------------------------
Programa 8
%{
#include <stdio.h>
#include <conio.h>
%}
%option noyywrap
alfa [a-d]
L (a|ab)*
%%
"bye" {bye();return 0;}
{L}|" " {printf("Si pertenece al Lenguaje : %s", yytext);}
{alfa}*|^L {printf("No pertenece al Lenguaje : %s", yytext);}
. printf("%s",yytext[0]);
%%
main(){
printf("Programa que reconoce la e.r (a|ab)*\nIngrese letras del rango [a-d]\nIngrese bye para salir\n"); yylex();
}
bye()
{ printf("Fin del programa\n"); }
--------------------------------------------------------------------
Programa 9
%{
#include <stdio.h>
#include <conio.h>
%}
%option noyywrap
alfa [a-d]
L (a|b)*
%%
"bye" {bye();return 0;}
{L}|" " {printf("Si pertenece al Lenguaje : %s", yytext);}
{alfa}*|^L {printf("No pertenece al Lenguaje : %s", yytext);}
. printf("%s",yytext[0]);
%%
main(){
printf("Programa que reconoce la e.r (a|b)*\nIngrese letras del rango [a-d]\nIngrese bye para salir\n"); yylex();
}
bye()
{ printf("Fin del programa\n"); }
----------------------------------------------------
Programa 10
%{
#include <stdio.h>
#include <conio.h>
%}
%option noyywrap
alfa [a-d]
L (a|b)*aa(a|b)*
%%
"bye" {bye();return 0;}
{L} {printf("Si pertenece al Lenguaje : %s", yytext);}
{alfa}*|^L {printf("No pertenece al Lenguaje : %s", yytext);}
. printf("%s",yytext[0]);
%%
main(){
printf("Programa que reconoce la e.r (a|b)*aa(a|b)*\nIngrese letras del rango [a-d]\nIngrese bye para salir\n"); yylex();
}
bye()
{ printf("Fin del programa\n"); }
--------------------------------------------------------------------
Programa 11
%{
#include <stdio.h>
#include <conio.h>
%}
%option noyywrap
alfa [a-d]
L (a|" ")(a|ab)*
%%
"bye" {bye();return 0;}
{L}|" " {printf("Si pertenece al Lenguaje : %s", yytext);}
{alfa}*|^L {printf("No pertenece al Lenguaje : %s", yytext);}
. printf("%s",yytext[0]);
%%
main(){
printf("Programa que reconoce la e.r (a|e) (a|ab)*\nIngrese letras del rango [a-d]\nIngrese bye para salir\n"); yylex();
}
bye()
{ printf("Fin del programa\n"); }
------------------------------------------------------------------
Programa 12
%{
#include <stdio.h>
#include <conio.h>
%}
%option noyywrap
alfa [a-d]
L (a*|b)*abb
%%
"bye" {bye();return 0;}
{L} {printf("Si pertenece al Lenguaje : %s", yytext);}
{alfa}*|^L {printf("No pertenece al Lenguaje : %s", yytext);}
. printf("%s",yytext[0]);
%%
main(){
printf("Programa que reconoce la e.r (a*|b)*abb \nIngrese letras del rango [a-d]\nIngrese bye para salir\n"); yylex();
}
bye()
{ printf("Fin del programa\n"); }
Comentarios sobre la versión: 1.0 (0)
No hay comentarios