cc lab 13 usman.docx - Bahria University Lahore Campus Department of Computer Sciences Lab Journal 13(Fall 2018 Course Compiler Construction Lab Date

cc lab 13 usman.docx - Bahria University Lahore Campus...

This preview shows page 1 - 3 out of 3 pages.

Bahria University, Lahore Campus Department of Computer Sciences Lab Journal 13 (Fall 2018) Course: Compiler Construction Lab Date: Course Code: CSL-323 Max Marks: 20 Faculty’s Name: Nadeem Server Lab Engineer : Atta ur rehman Name: Usman Khalid Enroll No: 03-134161-024 Lab Tasks: int evaluate( treeNode * t ) { int v1, v2, opr; if ( t != NULL ) { if ( t ->exp == ConstK ){ // return t->value; cout << "mov ax, " << t ->opr.num << endl; } else { v1 = evaluate( t ->leftchild); v2 = evaluate( t ->rightchild); switch ( t ->opr.tkn) { case PLUS : // v1 = v1 + v2; cout<< "pop ax\n" ; cout<< "pop bx\n" ; cout<< "add ax, bx\n" ; cout<< "push ax\n" ; break ; case MINUS :
Image of page 1
//v1 = v1 - v2; cout << "pop ax\n" ; cout << "pop bx\n" ; cout << "sub
Image of page 2
Image of page 3

You've reached the end of your free preview.

Want to read all 3 pages?

  • Fall '18
  • Zia Ul Rehman
  • Subroutine, Void type, Carriage return, int v1

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes