Lex/Flex [Practical] - Use lex/flex to implement functionalities of an editor. For a…
- User
Lex/Flex [Practical] - Use lex/flex to implement functionalities of an editor.
For a given input source file written in C, implement the following functionali- ties using lex/flex ( Write different lex source files for each functionality), i.e, each
source file read the input file and implement a single functionality. (a) Count the number of characters, words and lines in the input file. (b) Count the number of occurrences of "int" and replace each occurrence of int by float. (c) Comment the entire code in the input file. (d) Uncomment the commented code in the input file. (e) Remove the commented code in the input file. (f) Change uppercase characters in the inputfile to lowercase. (g) Change lowercase characters in the inputfile to uppercase.
- Assistant
Here is an example implementation for each functionality using lex/flex:
(a) Counting characters, words, and lines:
perl