Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %{
- #include "y.tab.h"
- #include <stdio.h>
- #include <iostream>
- #include <stdlib.h>
- #include <string.h>
- using namespace std;
- %}
- keywords "False" |"await" |"else" |"import" |"pass" |"None" |"break" |"except" |"in" |"raise" |"True" |"class" |"finally" |"is" |"return" |"and" |"continue" |"for" |"lambda" |"try" |"as" |"def" |"from" |"nonlocal" |"while" |"assert" |"del" |"global" |"not" |"with" |"async" |"elif" |"if" |"or" |"yield"
- identifier [a-zA-Z_][a-zA-Z0-9_]*
- letter = [a-zA-Z]
- number = [0-9]+
- alphanumeric = (letter | number)+
- dquote "\"[^"]*\""
- squote "\'[^']*\'"
- %%
- \r|\n|\r\n {}
- ":" {
- return COLON;
- }
- "." {
- return DOT;
- }
- "(" {
- return LBRACE;
- }
- ")" {
- return RBRACE;
- }
- {dquote} {
- yylval == yytext;
- return STRING;
- }
- {squote} {
- yylval == yytext;
- return STRING;
- }
- {identifier} {
- yylval == yytext;
- return IDENTIFIER;
- }
- def {
- yylval = yytext;
- return DEF;
- }
- class {
- yylval == yytext;
- return CLASS;
- }
- %%
Add Comment
Please, Sign In to add comment