Presentation is loading. Please wait.

Presentation is loading. Please wait.

CMPE 152: Compiler Design February 28 / March 5 Lab

Similar presentations


Presentation on theme: "CMPE 152: Compiler Design February 28 / March 5 Lab"— Presentation transcript:

1 CMPE 152: Compiler Design February 28 / March 5 Lab
Department of Computer Engineering San Jose State University Spring 2019 Instructor: Ron Mak

2 Today’s Lab Assignment #4: New Built-in Complex Type.

3 Assignment #4: Complex Type
Add a built-in complex data type to Pascal. Add the type to the global symbol table. Implement as a record type with permanent real fields re and im. Declare complex numbers and assign values to them: VAR     x, y, z : complex; BEGIN      x.re := 15;     x.im := 37;          y.re := ;     y.im := ;     z := x; END.

4 Assignment #4, cont’d Start with the C++ source files from Chapter 10.
Examine wci::intermediate::symtabimpl::Predefined to see how the built-in types like integer and real are defined. Examine wci::frontend::pascal::parsers::RecordTypeParser to see what information is entered into the symbol table for a record type.

5 Assignment #4, cont’d The only source files you should need to modify are Predefined.h and Predefined.cpp. If you successfully implement the new complex type, assignments to complex variables should simply work with no further code changes. Due Wednesday, March 13.


Download ppt "CMPE 152: Compiler Design February 28 / March 5 Lab"

Similar presentations


Ads by Google