Created
November 22, 2017 20:30
-
-
Save vishichoudhary/fec4aad9d0e2f32bb5592b6aeac0ca27 to your computer and use it in GitHub Desktop.
ho haa
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%{ | |
#include<stdio.h> | |
%} | |
delim [\t ] | |
ws {delim}+ | |
letter [A-Za-z] | |
digit [0-9] | |
id {letter}({letter}|{digit})* | |
num {digit}+(\.{digit}+)?(E[+/-]?{digit}+)? | |
%% | |
ws {printf("no action fuck you");} | |
if|else|then {printf("%s is a keyword",yytext);} | |
{id} {printf("%s is a identifier",yytext);} | |
{num} {printf(" it is a number");} | |
"<" {printf("it is a relational operator less than");} | |
"<=" {printf("it is a relational operator less than or equal");} | |
">" {printf("it is a relational operator greater than");} | |
">=" {printf("it is a relational operator greater than");} | |
"==" {printf("it is a relational operator equal");} | |
"<>" {printf("it is a relational operator not equal");} | |
. { printf("i don't recognize it ");} | |
%% | |
main() | |
{ | |
yylex(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment