Compiler Construction Lab Manual / Counting Positive Negative Numbers From A File lex Program

Program Name

Write a Compiler Construction Program for Counting Positive Negative Numbers From A File lex Program.
Theory
Counting Positive Negative Numbers From A File lex Program
Program Code


Saving: vi positive.l

Compiling and Running
lex positive.l
cc lex.yy.c
./a.out file2.c
Input
//Vi file2.c +1
2
6
-9
6
8
-4
-5
-6
+2
+4


Output
no of positive numbers=7 no of negative numbers=4


Home     Back