-
Notifications
You must be signed in to change notification settings - Fork 0
/
interactive_deduction.l
34 lines (30 loc) · 1.02 KB
/
interactive_deduction.l
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
%option noyywrap
%option nounput
%{
#include <cstdio>
#include <cstdlib>
#include <string>
#include "formula.hpp"
using namespace std;
// Including header where tokens are defined
#include "interactive_deduction.tab.hpp"
%}
%%
True { return true_token; }
False { return false_token; }
[a-zA-Z]([a-zA-Z_])* {
yylval.s = new string(yytext);
return atom_token;
}
"~" { return not_token; }
"/\\" { return and_token; }
"\\/" { return or_token; }
"=>" { return imp_token; }
"<=>" { return iff_token; }
[()\n] { return *yytext; }
[ \t] { }
. {
fprintf(stderr, "Lexical error: unknown character %c\n", *yytext);
exit(EXIT_FAILURE);
}
%%