Home ยป Case Statements

Case Statements

Switch and case statement is available in a variety of languages. The syntax of case statement is as follows:

The translation scheme for this shown below:

Code to evaluate E into T

  • When switch keyword is seen then a new temporary T and two new labels test and next are generated.
  • When the case keyword occurs then for each case keyword, a new label Li is created and entered into the symbol table. The value of Vi of each case constant and a pointer to this symbol-table entry are placed on a stack.

Next TopicSymbol Table

You may also like