Merge pull request #4 from UB-CSE443/Sprint1-Type/Keywards-FE-t#07
Sprint1 type/keywards fe t#07
This commit is contained in:
BIN
lexicalStructure
BIN
lexicalStructure
Binary file not shown.
@ -7,7 +7,7 @@
|
|||||||
%{
|
%{
|
||||||
#include "typedefs.h"
|
#include "typedefs.h"
|
||||||
%}
|
%}
|
||||||
|
int line_number = 1, column_number = 1;
|
||||||
|
|
||||||
DIGIT [0-9]
|
DIGIT [0-9]
|
||||||
CHAR \\n|\\t|\\'|[^'\n\t\\]
|
CHAR \\n|\\t|\\'|[^'\n\t\\]
|
||||||
@ -21,15 +21,35 @@ COMMENTCHAR [^\*]|\*[^\)]
|
|||||||
%%
|
%%
|
||||||
|
|
||||||
|
|
||||||
|
\n line_number++ column_number = 1;
|
||||||
|
. column_number++;
|
||||||
|
|
||||||
|
"integer" {return T_INTEGER}
|
||||||
|
"address" {return T_ADDRESS}
|
||||||
|
"Boolean" {return T_BOOLEAN}
|
||||||
|
"character" {return T_CHARACTER}
|
||||||
|
|
||||||
|
|
||||||
/* rules */
|
/* rules */
|
||||||
{DIGIT}+ {printf( "C_INTEGER: %s (%d)\n", yytext, atoi( yytext ) );}
|
{DIGIT}+ {printf( "C_INTEGER: %s (%d)\n", yytext, atoi( yytext ) );}
|
||||||
|
|
||||||
"null" {printf( "C_NULL: %s (%d)\n", yytext, atoi( yytext ) );}
|
"null" {printf( "C_NULL: %s (%d)\n", yytext, atoi( yytext ) );}
|
||||||
|
|
||||||
|
"while" {return WHILE}
|
||||||
|
"if" {return IF}
|
||||||
|
"then" {return THEN}
|
||||||
|
"else" {return ELSE}
|
||||||
|
"type" {return TYPE}
|
||||||
|
"function" {return FUNCTION}
|
||||||
|
"return" {return RETURN}
|
||||||
|
"external" {return EXTERNAL}
|
||||||
|
"as" {return AS}
|
||||||
|
|
||||||
'{CHAR}' {printf( "C_CHARACTER: %s (%d)\n", yytext, atoi( yytext ) );} /*using double \ per documentation to show escaped chars*/
|
'{CHAR}' {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 ) );}
|
"true" {printf( "C_TRUE: %s (%d)\n", yytext, atoi( yytext ) );}
|
||||||
|
|
||||||
|
|
||||||
"false" {printf( "C_FALSE: %s (%d)\n", yytext, atoi( yytext ) );}
|
"false" {printf( "C_FALSE: %s (%d)\n", yytext, atoi( yytext ) );}
|
||||||
|
|
||||||
/* OPERATORS */
|
/* OPERATORS */
|
||||||
|
Reference in New Issue
Block a user