1 / 4

In-class diagrams (9/20/2010) {week 04}

The College of Saint Rose CIS 433 – Programming Languages David Goldschmidt, Ph.D. In-class diagrams (9/20/2010) {week 04}. from Concepts of Programming Languages , 9th edition by Robert W. Sebesta, Addison-Wesley, 2010, ISBN 0-13-607347-6. Building a lexical analyzer ( i ).

Download Presentation

In-class diagrams (9/20/2010) {week 04}

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

Presentation Transcript


  1. The College of Saint Rose CIS 433 – Programming Languages David Goldschmidt, Ph.D. In-class diagrams (9/20/2010){week 04} from Concepts of Programming Languages, 9th edition by Robert W. Sebesta, Addison-Wesley, 2010, ISBN 0-13-607347-6

  2. Building a lexical analyzer (i) • To build a lexical analyzer, we first must define the state transition diagram • Describes how the token is identified • Consists of a start state andat least one final state • Transitions occur based oncharacters encountered onthe input stream • What’s wrong with this diagram? minus(-) start neg digit (0-9) digit (0-9) digit (0-9) int

  3. Building a lexical analyzer (ii) minus(-) start neg handle all valid integer literals, including 0, 1, -1, 100, 123, etc. 0 digit (1-9) digit (1-9) digit (0-9) int int

  4. Building a lexical analyzer (iii) 0 dot minus(-) digit (1-9) digit (0-9) start neg dot dot 0 dbl digit (1-9) digit (0-9) digit (1-9) int int dot dot handle all valid floating-point numbers

More Related