1. Firstly, make the lex file according to the given format and then save the file with extension ".l" such as: "file_name.l".
2. Lex files can be compiled using any Lex Analyzers like 'flex' Analyzer for Windows.
3.Use the lex program to turn into a C language program. The resulting program is in the lex.yy.c file.
4. Use the C compiler with the -ll flag to compile and link the program with a library of lex subroutines. The resulting executable program is in the a.out file.
For Example,
$$ lex file_name.l
$$ gcc lex.yy.c -ll
$$ ./a.out
OR
2. Lex files can be compiled using any Lex Analyzers like 'flex' Analyzer for Windows.
3.Use the lex program to turn into a C language program. The resulting program is in the lex.yy.c file.
4. Use the C compiler with the -ll flag to compile and link the program with a library of lex subroutines. The resulting executable program is in the a.out file.
For Example,
$$ lex file_name.l
$$ gcc lex.yy.c -ll
$$ ./a.out
OR
$$ lex -t file_name.l > file_name.c
$$ cc -o file_name file_name.c -ll
No comments:
Post a Comment