Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

201506 CSE340 Lecture 23

458 views

Published on

Intermediate Code (part 4/4)

Published in: Software
  • Be the first to comment

  • Be the first to like this

201506 CSE340 Lecture 23

  1. 1. CSE340 - Principles of Programming Languages Lecture 23: Intermediate Code IV Javier Gonzalez-Sanchez BYENG M1-38 Office Hours: By appointment
  2. 2. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 8 Code WHILE
  3. 3. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 9 Code
  4. 4. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 10 Code IF
  5. 5. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 11 Code
  6. 6. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 12 Review Programming Assignment 4 Level 3 Bonus Points: SWITCH
  7. 7. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 13 Homework Translate this source code to intermediate code: int a; switch (a) { case 1: { print("hi”); break;} case 2: { print("world"); break;} default: { print(”end"); break;} }
  8. 8. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 14 Handwritten notes Add the symbol table here…
  9. 9. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 15 Homework Assignment #4
  10. 10. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 16 High-Level Languages X,E,G,O,O #e1,I,I,0,7 @ OPR 19, AX STO x, AX LIT 5, AX OPR 21, AX LOD #e1,AX CAL 1, AX OPR 0, AX 5 Virtual Machine (interpreter) // sorce code int x; int foo () { read (x); print (5); } main () { foo (); } Lexer Parser Semantic Analyzer Code Generation 01001010101000010 01010100101010010 10100100000011011 11010010110101111 00010010101010010 10101001010101011 Assembler compilation execution
  11. 11. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 17 Language Paradigms
  12. 12. CSE340 - Principles of Programming Languages Javier Gonzalez-Sanchez javiergs@asu.edu Summer 2015 Disclaimer. These slides can only be used as study material for the class CSE340 at ASU. They cannot be distributed or used for another purpose.

×