Flex Programs

FLEX PROGRAMS

Flex is a lexical analyzer generator, which is a tool for programming that recognizes lexical patterns in the input with the help of flex specifications.Scroll below to see the list of flex programs.

Structure of a Flex program

Definition Section

%%

Rules Section

%%

User Code

Definition Section

In this section, flex tool converts the lex specifications to a lexical analyzer. This section contains global declarations and header files. 

Rules Section

This section contains the pattern and corresponding action. The pattern part contains a regular expression of the lexical analyzer and the action part is a C code, which will be executed when a pattern matches with the input.

User Defined Section(Auxiliary Section)

This section contains any valid C code. 

Share Me!
  •  
  •  
  •  
  •  
  •  
  •