Lex is a computer program that generates lexical analyzers and was written by Mike Lesk and Eric Schmidt. Lex reads an input stream specifying the lexical analyzer and outputs source code implementing the lex in the C programming language.
In C, an identifier must begin with either an alphabet or underscore, it can not begin with a digit or any other special character, moreover digits can come after.
gfg : valid identifier 123 : invalid identifier _abc12 : valid identifier #abc : invalid identifier
Let’s see the lex program to determine whether input is an identifier or not.
- Lex Program to Identify and Count Positive and Negative Numbers
- Lex program to recognize valid arithmetic expression and identify the identifiers and operators
- Lex Program to remove comments from C program
- Lex Program For checking a valid URL
- Lex program to check whether a given number is even or odd
- Lex program for Decimal to Hexadecimal Conversion
- Lex program to check whether input number is odd or even
- Lex program to implement a simple Calculator
- Lex program to check perfect numbers
- Lex program to check if a Date is valid or not
- Lex program to find the Length of a String
- Lex program for Decimal to Binary Conversion
- Lex Program to check whether a number is Prime or Not
- Lex program to check whether given string is Palindrome or Not
- Lex program to search a word in a file
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.