aboutsummaryrefslogtreecommitdiff
path: root/2
diff options
context:
space:
mode:
authorAkshay <[email protected]>2021-04-30 17:55:19 +0100
committerAkshay <[email protected]>2021-04-30 17:55:19 +0100
commitda1764a9f839e1d29b2bee12d35534f71f05c6ff (patch)
treed410c2191e571f9e6945ed88afd3faa1175675b3 /2
parent9ff0cec8b507d9164d8828dcb2a87012e140fdf5 (diff)
law & order
Diffstat (limited to '2')
-rw-r--r--2/input5
-rw-r--r--2/main.l29
2 files changed, 0 insertions, 34 deletions
diff --git a/2/input b/2/input
deleted file mode 100644
index 5ad8acb..0000000
--- a/2/input
+++ /dev/null
@@ -1,5 +0,0 @@
1this is the first para text.
2another line in this para.
3
4this is the second para text.
5another line in this para.
diff --git a/2/main.l b/2/main.l
deleted file mode 100644
index 872c7bc..0000000
--- a/2/main.l
+++ /dev/null
@@ -1,29 +0,0 @@
1%{
2int word_count = 0;
3int line_count = 0;
4int char_count = 0;
5int para_count = 0;
6int spaces = 0;
7%}
8
9%%
10\n line_count++;
11[ \t] spaces++;
12[A-Za-z]+ { word_count++; char_count+=yyleng;};
13\n\n para_count++;
14<<EOF>> {para_count++; return 1;};
15. ;
16%%
17
18int main(void) {
19 yylex();
20 printf("%d lines\n", line_count);
21 printf("%d words\n", word_count);
22 printf("%d blanks\n", spaces);
23 printf("%d characters\n", char_count);
24 printf("%d paragraphs\n", para_count);
25}
26
27int yywrap() {
28 return(1);
29}