Skip to content
Snippets Groups Projects
Commit daedbda5 authored by johti17's avatar johti17
Browse files

Fixed capitalization expanded Lab 4 instructions slightly README

parent 426bfae8
No related branches found
No related tags found
1 merge request!5Feedback 2023
......@@ -71,9 +71,58 @@ diff -y my_output.txt ../traces/trace-lab3.txt
## Lab 4
In lab 4 you will work in file `codegen.cc` search for `/* --- Your code here --- */`'
In Lab 4 you will work in file `codegen.cc` search for `/* --- Your code here --- */`'
to see where you need to introduce your changes.
A good place to start is the function `BinaryGenerateCode`
```C++
/*
*
* This function is used to generate code for all kinds of binary
* operators and relations. The arguments to the function are the
* following:
*
* q The QuadsList onto which the generated code is placed.
* realop The quad to generate for the operator if the arguments
* are of type real.
* intop The quad to generate for the operator if the arguments
* are of type integer.
* left The AST for the left-hand side of the operator. The
* value type of this AST must be the same as that of the
* AST for the right-hand side.
* right The AST for the right-hand side of the operator. The
* value type of this AST must be the same as that of the
* AST for the left-hand side.
* node The operator node itself. You probably won't need this
* unless you want to print an error message.
* type If not NULL, this is the type of the result. This is
* used for relations, where the type of the result is
* always integer, even if the operands are real. If this
* parameter is NULL, then the type of the result is the
* same as the type of the operands (the parser needs to
* make sure that the operands have the same type.)
*
* See the GenerateCode methods for the binary operators for
* examples of how this function is used.
*
*/
static VariableInformation *BinaryGenerateCode(QuadsList& q,
tQuadType realop,
tQuadType intop,
ASTNode *left,
ASTNode *right,
ASTNode *node,
TypeInformation *type = NULL)
{
/* --- Your code here --- */
return NULL;
/* --- End your code --- */
}
```
### Testing Lab 4
In order to test Lab 4, there exists a test script.
For more details see the README in the test folder.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment