-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathscale_expression.ll
40 lines (27 loc) · 902 Bytes
/
scale_expression.ll
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
* This application is free software and is released under the terms of
* the BSD license. See LICENSE file for details.
*
* Copyright (c) 2012 Volker Poplawski (volker@openbios.org)
*/
/* tell flex the input is not interactive */
%option never-interactive
%option noyywrap
%{
#define YYSTYPE double
extern "C" int yylex();
#include "scale_expression.bison.h"
%}
DIGIT [0-9]
%%
"+" { return '+'; }
"-" { return '-'; }
"*" { return '*'; }
"/" { return '/'; }
"(" { return '('; }
")" { return ')'; }
"^" { return '^'; }
[ \t\n\r]+ ;
{DIGIT}+"."{DIGIT}* { sscanf( yytext, "%lf", &yylval ); return NUM; }
{DIGIT}+ { sscanf( yytext, "%lf", &yylval ); return NUM; }
%%