2021-04-18 21:10:15 +00:00
|
|
|
%{
|
|
|
|
#include "y.tab.h"
|
|
|
|
%}
|
|
|
|
|
2021-04-16 21:40:28 +00:00
|
|
|
%option noyywrap
|
2021-04-16 07:35:35 +00:00
|
|
|
|
|
|
|
%%
|
2021-04-21 02:00:18 +00:00
|
|
|
"void" return VOID;
|
2021-04-16 21:40:28 +00:00
|
|
|
"int" return INT;
|
|
|
|
"uint" return UINT;
|
|
|
|
"float" return FLOAT;
|
|
|
|
"double" return DOUBLE;
|
|
|
|
"string" return STRING;
|
|
|
|
"bool" return BOOL;
|
2021-04-18 20:14:50 +00:00
|
|
|
"struct" return STRUCT;
|
2021-04-18 20:30:50 +00:00
|
|
|
"return" return RETURN;
|
2021-04-22 07:35:42 +00:00
|
|
|
"static" return STATIC;
|
2021-04-24 19:59:30 +00:00
|
|
|
"Reference" return REFERENCE;
|
2021-04-28 19:49:45 +00:00
|
|
|
"alloc" return ALLOC;
|
2021-04-29 04:25:25 +00:00
|
|
|
"if" return IF;
|
|
|
|
"else" return ELSE;
|
2021-04-21 02:00:18 +00:00
|
|
|
[0-9]+ return NUMBER;
|
2021-04-16 07:35:35 +00:00
|
|
|
[a-zA-Z][a-zA-Z0-9]* return ID;
|
2021-04-16 21:40:28 +00:00
|
|
|
\"[a-zA-Z][a-zA-Z0-9]*\" return STRING_LITERAL;
|
2021-04-16 07:35:35 +00:00
|
|
|
"+" return PLUS;
|
|
|
|
"-" return MINUS;
|
2021-04-20 17:47:40 +00:00
|
|
|
"*" return STAR;
|
|
|
|
"/" return SLASH;
|
|
|
|
"%" return PERCENT;
|
2021-04-16 07:35:35 +00:00
|
|
|
"<" return LESS_THAN;
|
|
|
|
">" return GREATER_THAN;
|
|
|
|
"=" return EQUAL;
|
|
|
|
"\"" return QUOTE;
|
|
|
|
"!" return BANG;
|
|
|
|
"|" return BAR;
|
|
|
|
"&" return AMPERSAND;
|
|
|
|
"." return POINT;
|
|
|
|
"," return COMMA;
|
|
|
|
";" return SEMICOLON;
|
|
|
|
":" return COLON;
|
|
|
|
"?" return QUESTION;
|
|
|
|
"(" return LEFT_PAREN;
|
|
|
|
")" return RIGHT_PAREN;
|
|
|
|
"[" return LEFT_BRACKET;
|
|
|
|
"]" return RIGHT_BRACKET;
|
|
|
|
"{" return LEFT_BRACE;
|
|
|
|
"}" return RIGHT_BRACE;
|
|
|
|
"//" return COMMENT;
|
2021-04-16 21:40:28 +00:00
|
|
|
" " ;
|
|
|
|
"\n" ;
|
2021-04-16 07:35:35 +00:00
|
|
|
[ \t] ;
|
|
|
|
%%
|