Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 11

Welcome to our Presentation

1
Lab-7: Recognize a few patterns or token

Presented By
Mahfuzur Rahman
ID:191-15-12378
Md Zahirul Islam Mehadi
ID: 191-15-12223

Sec : H
Implemented Topic
 Converting a sequence of characters into a sequence of token.

3
Procedure
1. Start the program
2. Include all necessary header file.
3. Allocate memory for all the variable and function.
4. Use the file accessing function and variable to read the demo
file(Input File).
5. Separate all the file contents as tokens and match it with the
functions.
6. Declared a array to store all the keywords.
7. Ignore all arithmetic operator.

4
Procedure
7. Generate string and check all keywords.
8. Finally print the output after recognizing all the tokens.
9. Stop the program.

5
Basic Idea
 Regular expression is a notation for defining the set of
tokens that normally occur in programming languages.
 Check a sequence of characters arithmetic operator and
space
 Breaks input into token
 Found Keyword and identifier

6
Basic Idea
 Declared 33 keywords.
 Found Keyword, identifier and operator.
 If Matching to keywords , then print keywords.
 If not keywords, then print identifiers.
 Take input to file and close file .

7
Input

8
Output

9
Phase of Compiler

Works on compiler lexical analyzer phase.


 Lexical Analyzer creates lexeme .

10
thanks!

11

You might also like