Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
Lexical Analysis (Overview):
Lexical analysis is the process of converting a sequence of characters from source program into a sequence of tokens. A lexical analyzer is a pattern matcher for character strings:
?A lexical analyzer is a “front-end” for the parser
?A lexical analyzer identifies substrings of the source program that belong together.
?A program which performs lexical analysis is termed as a lexical analyzer (lexer), tokenizer or scanner.
There are three approaches to building a lexical analyzer:
1.Write a formal description of the tokens and use a software tool that constructs a table-driven lexical analyzer from such a description
2.Design a state diagram that describes the tokens and write a program that implements the state diagram
3.Design a state diagram that describes the tokens and hand construct a table-driven implementation of the state diagram
Overview: For this assignment, you will design a state diagram that describes the tokens and write a program that implements the state diagram which recognizes a specific form of C-based comments: those that begin with /* and end with */
Requirements:
1.Design/present a state diagram which recognizes this form of C-based comments: those that begin with /* and end with */
2.In the programming language of your choice, write and test code which implements the state diagram of this problem (recognizes the C style comments described above)