INTRODUCTION: Writing a computer is tedious and time consuming task. There are some specialized tools for helping in implementation of various phases of compilers. These tools are called compiler construction tools. These tools are also called compiler-compiler, compiler-generator, or translator writing system.
TOOLS FOR COMPILER :
Lex
Flex lexical Analyser
Quex
Ragel
Yacc
Antlr
LEX: Lex is a computer program that generates lexical analyzers ("scanners" or "lexers"). Lex is commonly used with the yacc parser generator. Lex, originally written by Mike Lesk and Eric Schmidt and described in 1975, is the standard lexical analyzergenerator on many Unix systems, and an equivalent tool is specified as part of the POSIX standard.
The structure of a Lex file is intentionally similar to that of a yacc file; files are divided into three sections, separated by lines that contain only two percent signs, as follows:
Definition section
%%
Rules section
%%
The definition section defines macros and imports header files written in C. It is also possible to write any C code here, which will be copied verbatim into the generated source file.
The rules section associates regular expression patterns with C statements. When the lexer sees text in the input matching a given pattern, it will execute the associated C code.
The C code section contains C statements and functions that are copied verbatim to the generated source file. These statements presumably contain code called by the rules in the rules section. In large programs it is more convenient to place this code in a separate file linked in at compile time.
FLEX: Flex (fast lexical analyzer generator) is a free software alternative to lex. It is a computer program that generates lexical analyzers("scanners" or "lexers"). It is frequently used with the free Bison parser generator. Unlike Bison, flex is not part of the GNU Project.