Lex is a computer program that generates lexical analyzers. Lex reads an input stream specifying the lexical analyzer and outputs source code implementing the lexer in the C programming language.
Prerequisite: Flex (Fast lexical Analyzer Generator).
Given an input, the task is to check if the input is digit or not.
Input: 28 Output: digit Input: a Output: not a digit. Input: 21ab Output: not a digit.
Below is the implementation:
GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details
- Lex program to check whether input number is odd or even
- Lex program to take input from file and remove multiple spaces, lines and tabs
- Lex Program to print the total characters, white spaces, tabs in the given input file
- Lex program to check whether a given number is even or odd
- Lex Program to check valid email
- Lex Program to check whether a number is Prime or Not
- Lex program to check perfect numbers
- Lex program to check whether given string is Palindrome or Not
- Lex program to check if a Date is valid or not
- C program to check syntax of 'for' loop
- YACC program to check whether given string is Palindrome or not
- Lex program to check valid Mobile Number
- Lex program to check whether given number is armstrong number or not
- Lex program to check whether an year is a leap year or not
- Input Buffering in Compiler Design
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.