#@title Writing Lex program
%%writefile program.l
%{
#include <stdio.h>
%}
%%
[ \t] ;
[0-9]+\
.[0-9]+ {printf
("\nFound a floating
-point
number:"
); printf("%s",yytext);}
[0-9]+ {printf
("\nFound an
integer:"
); printf
("
%s",yytext); } [a-zA-Z0-9]+ {printf("\nFound a string: ");printf("%s",yytext);}
%%
main() {
// lex through the input:
yylex();
}
I0B0aXRsZSBXcml0aW5nIExleCBwcm9ncmFtCiUld3JpdGVmaWxlIHByb2dyYW0ubAolewojaW5jbHVkZSA8c3RkaW8uaD4KJX0KJSUKWyBcdF0gOwpbMC05XStcLlswLTldKyB7cHJpbnRmKCJcbkZvdW5kIGEgZmxvYXRpbmctcG9pbnQgbnVtYmVyOiIpOwpwcmludGYoIiVzIix5eXRleHQpO30KWzAtOV0rIHtwcmludGYoIlxuRm91bmQgYW4gaW50ZWdlcjoiKTsgcHJpbnRmKCIlcyIseXl0ZXh0KTsgfQpbYS16QS1aMC05XSsge3ByaW50ZigiXG5Gb3VuZCBhIHN0cmluZzogIik7cHJpbnRmKCIlcyIseXl0ZXh0KTt9CiUlCm1haW4oKSB7Ci8vIGxleCB0aHJvdWdoIHRoZSBpbnB1dDoKeXlsZXgoKTsKfQ==