We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 88a21fc commit 83d9bd8Copy full SHA for 83d9bd8
labs/04/language_ac.l
@@ -0,0 +1,30 @@
1
+%{
2
+#include <stdio.h>
3
+%}
4
+
5
+%option noyywrap
6
7
+letter [a-zA-Z]
8
+digit [0-9]
9
+number {digit}+
10
11
+%%
12
+\/{2}.* { printf("COMMENT "); }
13
+^f { printf("floatdcl "); }
14
+^i { printf("intdcl "); }
15
+= { printf("assign "); }
16
+\+ { printf("plus "); }
17
+\- { printf("minus "); }
18
+\* { printf("multiplication "); }
19
+\/ { printf("division "); }
20
+^p { printf("print "); }
21
+({letter}{digit}*)+ { printf("id "); }
22
+(0|([1-9]{digit}*))\.(({digit}*[1-9])|0) { printf("fnum "); }
23
+{number} { printf("inum "); }
24
+[ \t]+ /* ignore whitespace */
25
26
27
+int main() {
28
+ yylex();
29
+ return 0;
30
+}
0 commit comments