source: liacs/coco/assignment1/calc.l@ 257

Last change on this file since 257 was 2, checked in by Rick van der Zwet, 15 years ago

Initial import of data of old repository ('data') worth keeping (e.g. tracking
means of URL access statistics)

File size: 651 bytes
Line 
1/* C declarations */
2/* vi: set et ts=4: */
3%{
4
5#include <stdio.h>
6#include "y.tab.h"
7
8/* extern C declarations */
9#if defined(__cplusplus)
10extern "C" {
11#endif
12
13/* should be defined in stdio.h */
14extern int fileno(FILE *);
15
16#if defined(__cplusplus)
17}
18#endif
19
20
21int c;
22extern int yylval;
23
24%}
25
26%option nounput
27
28
29/* Patterns */
30%%
31
32" " ;
33"PI" { return PI; }
34"(" { return OPEN_PAREN; }
35")" { return CLOSE_PAREN; }
36"**" { return EXPONENT; }
37[0-9] {
38 c = yytext[0];
39 yylval = c - '0';
40 return DIGIT;
41 }
42
43
44[^0-9\b] {
45 c = yytext[0];
46 return c;
47 }
48
49%%
50
Note: See TracBrowser for help on using the repository browser.