Compiler Construction Lab Manual / Scanner Programs Using LEX

Program Name

Write a Compiler Construction Program for Scanner Programs Using LEX.
Theory
Scanner Programs Using LEX
Program Code


Create a text file b.txt and enter data.
Vi b.txt
hello world
welcome
12 + 24
" "

Saving: vi scanner.l

Compiling and Running
lex ab.l
cc lex.yy.c
./a.out
Input
Vi b.txt
hello world
welcome
12 + 24
" "


Output
hello is a Identifier
world is a Identifier
welcome is a Identifier

12 is a Signednumber
+ is a Operator
24 is a Signednumber

" is a Specialsymbol
" is a Specialsymbol


Home     Back