Lex File Format
A Lex program consists of three parts and is separated by %% delimiters:-
Declarations
%%
Translation rules
%%
Auxiliary procedures
Declarations: The declarations include declarations of variables.
Transition rules: These rules consist of Pattern and Action.
Auxiliary procedures: The Auxilary section holds auxiliary functions used in the actions.
For example:
declaration
number[0-9]
%%
translation
if {return (IF);}
%%
auxiliary function
int numberSum()
What is LEX in Compiler Design?
In this article, we will understand what is Lex in Compiler Design but before understanding Lex we have to understand what is Lexical Analysis.
Contact Us