ASSIGN #7
Add the appropriate actions to your parser to translate a source program into Three Address Code. For all class variables you must use offset notation.
Variables will have offsets starting at 0 and increasing based on the size of the variable.
ex. int num, sum;
int ave, limit;
num offset = 0 sum offset = 2
ave offset = 4 limit offset = 6
In three address code the variable limit would be referred to as _BP-6, however you may start your offsets at 2 as discussed in class if you like.
Parameters to methods will be referred to using positive offsets, for example:
Public int proc ( int num1, int num2)
Num2 would have offset 6 and num1 would have offset 4 and num1 would be referred to by _BP+4 as discussed in class. The C style will be used that pushes parameters from right to left.
Use the same name for the three address code file as the program's name only change the extension to .TAC. For example: if the input file is [login to view URL] the TAC file would have the name TEST15.tac.
You will need to add the following productions to your parser:
AssignStat -> idt = Expr |
idt = MethodCall |
MethodCall
MethodCall -> [login to view URL] ( Params )
ClassName -> idt
Params -> idt ParamsTail |
num ParamsTail|
ParamsTail -> , idt ParamsTail |
, num ParamsTail |
The statement:
[login to view URL](x,y);
Will result in the Three Address Statements:
push y
push x
call Proc
The statement:
A = [login to view URL](x,y);
Will result in the Three Address Statements:
push y
push x
call Proc
A = _AX
will send fulll information upon request
Hi , hope you are doing well
we are new company in freelancer.com but we have experience 5 years in software Development
we can start from today and finish it on the time
Thanks
OAtechnology