InterviewSolution
| 1. |
Explain the mechanism to determine if an input string belongs to the language given. |
|
Answer» String Processing Consider finding all occurrences of a short string (pattern string) within a long string (text string). This can be done by processing the text through a DFA: the DFA for all strings that end with the pattern string. Each time the accept state is reached, the current position in the text is output. Finite-State Machines A finite-state MACHINE is an FA together with actions on the arcs. Statecharts Statecharts MODEL tasks as a set of states and actions. They extend FA diagrams. Lexical AnalysisIn compiling a program, the first step is lexical analysis. This isolates keywords, identifiers etc., while eliminating irrelevant symbols. A token is a CATEGORY, for example “identifier”, “relation operator” or SPECIFIC keyword.Explanation: |
|