Compiler Construction Lab Manual / Counting WhitespacesWords Characters Lines in file LEX Program

Program Name

Write a Compiler Construction Program for Counting WhitespacesWords Characters Lines in file LEX Program.
Theory
Counting WhitespacesWords Characters Lines in file LEX Program
Program Code


Saving: vi CWWCL.l

Compiling and Running
lex CWWCL.L
cc lex.yy.c
./a.out a.txt
Input
Create a text file a.txt and enter data.

Vi a.txt
Prasad created this file1234 a1234
abcd

Output
the no.of character 34
the no.of words 6
the no.of lines2
the no.of space 4


Home     Back