summaryrefslogtreecommitdiff
path: root/lisp.lex
blob: 8122d8651a8ea288d816ecf46b2f0656f0de3144 (plain)
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
%{
#include <stdio.h>
#include <string.h>
#include "types.h"
#include "y.tab.h"
%}

%%
-?[0-9]+ {
    yylval.intlit = strdup(yytext);
    return INTLIT;
}

[A-z][A-z0-9]+|[+-/*%] {
    yylval.name = strdup(yytext);
    return NAME;
}

[(] {
	return yytext[0];
}

[)] {
	return yytext[0];
}

.|\n {;}

%%

int yywrap(){
	return 1;
}