Permalink
Cannot retrieve contributors at this time
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
40 lines (33 sloc)
828 Bytes
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
%option noyywrap | |
%option yylineno | |
%{ | |
#include <stdio.h> | |
#define YY_DECL int yylex() | |
#include "floc.tab.hpp" | |
%} | |
%% | |
[ \t] ; // ignore all whitespace | |
[0-9]+ { yylval.val = atoi(yytext); return T_INT;} | |
\n+ {return T_NEWLINE;} | |
"+" {return '+';} | |
"-" {return '-';} | |
"*" {return '*';} | |
"/" {return '/';} | |
"(" {return '(';} | |
")" {return ')';} | |
"{" {return '{';} | |
"}" {return '}';} | |
"|" {return '|';} | |
":" {return ':';} | |
"?" {return '?';} | |
"&" {return '&';} | |
"<" {return '<';} | |
">" {return '>';} | |
"=" {return '=';} | |
">=" {return T_GE;} | |
"<=" {return T_LE;} | |
"==" {return T_EQ;} | |
"!=" {return T_NE;} | |
"def" {return T_DEF;} | |
[a-zA-Z]+ { yylval.name = yytext; return T_ID;} | |
%% |