SlideServe
Menu
Preferences
© SlideServe · v2026

Lexical Analysis

len avatar
10 slides · 377 Views · 110 likes · Jul 17, 2014

Lexical Analysis . what is the main Task of the Lexical analyzer. Read the input characters of the source program, group them into lexemes and produce the tokens for the lexemes. Find out the token for the following code:. < Datatype , FLOAT > <id, ” limitedSquare ”> < LEFT_Par > <id, ‘x’>

Lexical Analysis - slide 1
01 / 10Lexical Analysis
1 / 17

Download Presentation

Lexical Analysis
An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

More Related Content

Presentation Transcript
  1. Lexical Analysis

  2. what is the main Task of the Lexical analyzer • Read the input characters of the source program, group them into lexemes and produce the tokens for the lexemes.

  3. Find out the token for the following code: <Datatype, FLOAT> <id, ”limitedSquare”> <LEFT_Par> <id, ‘x’> <Right_Par> < Datatype, FLOAT > <id, ‘x’> <{> <RETURN> …….

  4. Regular Expression

  5. Describe the language denoted by the following regular expression • a(a | b)*a Answer: String of a`s and b`s begin and end with a • (a | b)* a(a | b) (a | b) Answer: String of a`s and b`s, with an a in the 3rd letter from the right.

  6. Cont… • (a | b)*b (a | b)* b (a | b)* Answer: String of a`s and b`s that contain at least two b`s

  7. Write regular definition for the following languages: • All string of lowercase letters that contain the five vowels in order. Answer: L [b-d f-h j-n p-t v-z] String L*(a|A)+ L*(e|E)+ L*(i|I)+ L*(o|O)+ L*(u|U)+L*

  8. Cont… • Comments, consisting of a string surrounded by /* and */, without an intervening */, unless it is inside double-qoutes(“) Answer: L [a-zA-Z0-9] C “*/” comment /* (L*C* )* */

  9. Cont.. • String of a`s and b`s that contains odd number of b Answer: a*b(a*ba*b)*a* 

  10. Cont.. • String of a`s and b`s that contains just two or three b`s Answer: a*ba*ba*b?a*