Lex program to check whether an year is a leap year or not
Problem: Write a Lex program to check whether an year is a leap year or not.
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 lexer in the C programming language.
Note: Leap years are the years that are divisible by 400 or are divisible by 4 and not divisible by 100. So 2016, 2020 etc are leap years while 2017 and 2019 are not.
Input: 2016 Output: leap year Input: 2017 Output: not a leap year