Files
compiler-the-translators/lexicalStructure.lex

24 lines
745 B
Plaintext

/* Lexical Analysis with Flex (2.6.0) We used some of the code from this manual */
/* so we placed the citation here. */
/* definitions */
%option noyywrap
%{
#include <typedefs.h>
%}
%%
/* rules */
[0-9]+ {printf( "C_INTEGER: %s (%d)\n", yytext, atoi( yytext ) );}
"null" {printf( "C_NULL: %s (%d)\n", yytext, atoi( yytext ) );}
['][.]['] | [']\\[nt'\\]['] {printf( "C_CHARACTER: %s (%d)\n", yytext, atoi( yytext ) );} /*using double \ per documentation to show escaped chars*/
"true" {printf( "C_TRUE: %s (%d)\n", yytext, atoi( yytext ) );}
"false" {printf( "C_FALSE: %s (%d)\n", yytext, atoi( yytext ) );}
["][.]+["] {printf( "C_STRING: %s (%d)\n", yytext, atoi( yytext ) );}
%%
/* user code */