国产人妻人伦精品_欧美一区二区三区图_亚洲欧洲久久_日韩美女av在线免费观看

合肥生活安徽新聞合肥交通合肥房產生活服務合肥教育合肥招聘合肥旅游文化藝術合肥美食合肥地圖合肥社保合肥醫院企業服務合肥法律

CS 2210編程代寫、Java程序語言代做

時間:2023-11-27  來源:合肥網hfw.cc  作者:hfw.cc 我要糾錯



CS 2210 Programming Project (Part IV)
Code Generation
This project is intended to give you experience in writing a code generator as well as bring together
the various issues of code generation discussed in the text and in class.
Due date
The assignment is due December 9th, 2023, 11:59pm. This is the hard deadline and no extensions will be given for this project.
Project Summary
Your task is to write a code generator, the final phase of your compiler. It produces (target)
assembly code for the MIPS R2000 architecture. It takes as input the augmented AST and symbol
table produced by the previous phases of your compiler. The generated code will be executed using
SPIM S20, a simulator for the MIPS R2000.
Code generation will consist of assigning memory addresses for each variable used in the MINIJAVA program and translating subtrees of the AST (intermediate language representation) into
sequences of assembly instructions that perform the same task.
Code Generation
This is the only phase of your compiler which is machine dependent. Examples of assembly code
programs will be provided on the class webpage.
The important/interesting issues in generating code for MINI-JAVA are discussed in the following paragraphs. Please refer to chapter 7, 8 and class notes for further details on these issues,
You can make the following assumptions to simplify the project.
ˆ Code is generated for the intermediate instructions on a statement-by-statement basis without
taking into account the context of an intermediate instruction
ˆ code is generated for the intermediate instructions in the order that they occur within the
intermediate instruction sequence.
ˆ You may take advantage of any special instruction of the machine when choosing target
instructions for a given intermediate instruction.
ˆ You do not have to any fancy register allocation or optimization on your target code.
1
Computing Memory Addresses
Since address information has not been computed and entered into the symbol table by earlier
phases, the first task of the code generator is to compute the offsets of each variable name (both
global and local); that is, the address of each local data object and formal parameter within the
activation record for the block in which they are declared. This can be done by initializing a
variable offset at the start of each declaration section, and as each declaration is processed, the
current value of offset is entered as an attribute of that symbol, and offset is then incremented
by the total width of that data object (depending on its type).
The program execution begins with a method called main() being called. Since the language
has no way to initiate classes, all classes are instantiated when program execution begins. Thus,
all storage for all classes is allocated globally. The offsets of variables within classes should be
computed and stored as an attribute of the variable name, typically relative to the start of the class
or can just be relative to the start of the global storage.
For simplicity, declarations within a method donot contain any objects whose types are classes.
That is, local variables can only be of integer type or integer array type.
Call-by-value parameters will have a width dependent on the type of the parameter (remember
we are using only integer parameters), whereas call-by-reference parameters will have a width
equal to ONE word to store an address. The total activation record size of each method should be
computed at this time and entered in the symbol table as an attribute of the method name.
The machine architecture must be take into account when computing these widths, that is,
an integer in the MIPS processor is 4 bytes. Offsets of locals can be implemented as a negative
offset from the frame pointer while offsets of parameters can be positive from the frame pointer.
Thus, the computation of offsets of arguments and local variables can be done independently. This
information will be used upon every reference to the data object in addition to being used in the
allocation of storage for activation records.
Handling Structure Data Types
Storage for an array is allocated as a consecutive block of memory. Access to individual elements
of an array is handled by generating an address calculation using the base address of the array,
the index of the desired element, and the size of the elements. You are free to choose the layout of
elements of an array in your implementation (e.g., row major or column major order).
Simple Control Flow
Code for simple control statements, namely conditional and loops in MINI-JAVA, can be generated
according to the semantics of conventional programming languages using the compare and branch
instructions of the assembly language. Unique target labels will also have to be generated.
Method Invocation, Prologues, and Epilogues
Recursion in MINI-JAVA prevents the use of a static storage allocation strategy. However, the
language has no features that prevent the deallocation of activation records in a last-in-first-out
manner. That is, activation records containing data local to an execution of a method, actual
parameters, saved machine status, and other information needed to manage the activation of the
2
method can be stored on a run-time stack. The MIPS assembly language provides the subroutine
call mechanisms to manipulate the run-time user stack.
An activation record for a method is pushed onto the stack upon a call to that method, while
the activation record for the method is popped from the stack when execution of the method is
finished and control is to be returned to the caller. As MINI-JAVA does not allow dynamic classes
and arrays, the sizes of all activation records are known at compile time.
Method calls result in the generation of a calling sequence. Upon a call, an activation record for
the callee must be set up and control must be transferred to the callee after saving the appropriate
information in the activation record. For each method, the generated code sequence will consist of
a prologue, the code for the statements of the method, and the epilogue. Typically, the prologue
saves the registers upon a method call and allocates space on the stack for local variables, whereas
the epilogue consists of restoring the saved machine status and returning control to the point in the
caller immediately after the point of call. The handout on the MIPS assembly language explains
the instructions used to implement these actions.
Parameter passing
In order to correctly handle the formal parameters within the body of the callee, the symbol table
entry for each formal parameter must include an attribute that indicates the parameter passing
mode, that is, by-value or by-reference. Remember that we do not pass arrays as parameters. On
a method invocation, call-by-value parameters are handled by allocating the local store for the size
of the object in the activation record of the callee and then evaluating the actual parameter and
initializing the local store within the callee with the value of the actual parameter. All accesses to
that formal parameter will change the value in the local space, with no effect on the caller. On a
return, no values are copied back to the caller.
Call-by-reference parameters are handled by allocating local space in the callee’s activation
record for the address of the actual parameter and then copying the address of the actual parameter
into that local space. All accesses to that formal parameter during execution of the callee are indirect
accesses through this address, having a direct effect on the caller. On return, no action is taken
other than reclaiming the space.
Note that MIPS has a convention that the first 4 arguments of a method call are passed in
register $a0-$a3. You have the option to follow this convention.
Register Usage
In the MIPS processor, certain registers are typically reserved for special purposes. You should
abide by these conventions.
Possible Functions
You may want to write the following functions to help in the code generation.
1. emit call(func name, num arg)/*emit a call instruction; func name: function id lexeme pointer;
num arg: number of arguments */
2. emit label(l num)/*emit a definition of a label; l num: label number; example: L=102, code
generated = “L 102” */
3
3. emit goto(operator, l num) /*emit unconditional and conditional jump instructions; operator:
an operator in the branch-jump group; l num: label number */
4. emit data(name, type, size) /* emit one data line, which is used for STATIC allocation;
name: data object id lexeme pointer; type: type width; size: number of elements of above type
*/
5. emit str(name, str) /* emit a string constant definition line; name: pointer to the name
lexeme; str: pointer to the str */
6. emit most(operator, type, num op, op1, op2, op3) /* emit most of the instructions; operator:
one of the instructions in the general group; type: data type; num op: number of operators 1,
2 and/or 3; op1...3: operands, op2 and op3 can be omitted depending on num op */
Run-time Error Detection
You do not need to generate any run-time checks. Thus you can assume that array bounds are
within range and scalars are within range.
Testing your code
The code generated is MIPS assembly code and should follow the descriptions specified in the
handout SPIM S20. Samples will be put on the class webpage.
You can run the generated assembly code on the simulator and check the results. However, the
correct output does not guarantee that your code is completely correct. You should examine your
generated code carefully.
proj4> codeGen < sample1.java
proj4> spim -asm -file code.s
... ...
or
proj4> spim
(spim) load “code.s”
(spim) step
[0x00400000] 0x8fa40000 lw $4,0($29)
(spim) run
... ...
Assignment submission
Please submit your project in Canvas before the due time. The submission should be a compressed
file that contains your project source code and readme file (if any).
請加QQ:99515681 或郵箱:99515681@qq.com   WX:codehelp

掃一掃在手機打開當前頁
  • 上一篇:代寫CSC3100 Data Structures
  • 下一篇:CSCC43代做、R設計編程代寫
  • 無相關信息
    合肥生活資訊

    合肥圖文信息
    流體仿真外包多少錢_專業CFD分析代做_友商科技CAE仿真
    流體仿真外包多少錢_專業CFD分析代做_友商科
    CAE仿真分析代做公司 CFD流體仿真服務 管路流場仿真外包
    CAE仿真分析代做公司 CFD流體仿真服務 管路
    流體CFD仿真分析_代做咨詢服務_Fluent 仿真技術服務
    流體CFD仿真分析_代做咨詢服務_Fluent 仿真
    結構仿真分析服務_CAE代做咨詢外包_剛強度疲勞振動
    結構仿真分析服務_CAE代做咨詢外包_剛強度疲
    流體cfd仿真分析服務 7類仿真分析代做服務40個行業
    流體cfd仿真分析服務 7類仿真分析代做服務4
    超全面的拼多多電商運營技巧,多多開團助手,多多出評軟件徽y1698861
    超全面的拼多多電商運營技巧,多多開團助手
    CAE有限元仿真分析團隊,2026仿真代做咨詢服務平臺
    CAE有限元仿真分析團隊,2026仿真代做咨詢服
    釘釘簽到打卡位置修改神器,2026怎么修改定位在范圍內
    釘釘簽到打卡位置修改神器,2026怎么修改定
  • 短信驗證碼 豆包網頁版入口 破天一劍 目錄網 排行網

    關于我們 | 打賞支持 | 廣告服務 | 聯系我們 | 網站地圖 | 免責聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 hfw.cc Inc. All Rights Reserved. 合肥網 版權所有
    ICP備06013414號-3 公安備 42010502001045

    国产人妻人伦精品_欧美一区二区三区图_亚洲欧洲久久_日韩美女av在线免费观看
    日韩欧美精品在线不卡| 一级特黄录像免费播放全99| 国产深夜男女无套内射| 免费国产a级片| 黄在线观看网站| 黄色国产精品视频| 精品无人乱码一区二区三区的优势| 欧美中日韩免费视频| 欧美一区二区影视| 欧美国产日韩激情| 欧洲日本亚洲国产区| 日韩精品一区二区三区外面| 欧洲午夜精品久久久| 欧美成人高潮一二区在线看| 欧美凹凸一区二区三区视频| 黄色一级片播放| 国产欧美日韩小视频| 国产精品一区二区你懂得| 成人av在线不卡| 69久久夜色精品国产69| 久久久久久人妻一区二区三区| 久久久久久久久久国产| 国产精品爽爽爽爽爽爽在线观看| 国产精品久久久久久av| 欧美精品久久久久久久免费观看| 亚洲一区二区不卡视频| 日本中文字幕不卡免费| 欧美性受xxx| 国产日韩欧美二区| 国产精品333| 国产精品手机在线| 伊人久久99| 日韩精品国内| 国产免费一区二区三区| 久久精品午夜福利| 国产精品国产自产拍高清av水多 | 亚州国产精品久久久| 岛国一区二区三区高清视频| 欧美日韩亚洲国产成人| 成人羞羞国产免费网站| 日韩亚洲在线观看| 一区二区三区四区不卡| 欧日韩在线观看| 国产精品在线看| 视频在线一区二区| 亚洲综合自拍一区| 欧美日韩一区在线观看视频| 99爱视频在线| 国产精品久久久久久中文字| 日本中文字幕不卡免费| 高清av免费一区中文字幕| 久久久国产精品视频| 亚洲综合av一区| 国内精品久久久久久久久| 久久青青草原一区二区| 精品成在人线av无码免费看| 欧洲成人在线观看| 69av在线播放| 蜜臀久久99精品久久久久久宅男 | 午夜精品在线视频| 国产女精品视频网站免费| 久草视频国产在线| 亚洲熟妇av日韩熟妇在线| 欧美图片激情小说| 国产成人精品日本亚洲11| 久久久久国产一区二区三区| 韩国视频理论视频久久| 久久久久久久久久久国产| 亚洲精品国产系列| 成人免费在线网址| 久热精品在线视频| 欧美又粗又长又爽做受| 国产激情片在线观看| 亚洲色成人一区二区三区小说| 精品少妇人妻av一区二区| 色噜噜狠狠色综合网图区| 日本新janpanese乱熟| 91精品国产综合久久香蕉| 久久国产视频网站| 国产一区二区三区四区五区加勒比 | 欧美激情中文字幕在线| 精品婷婷色一区二区三区蜜桃| www.日韩不卡电影av| 日韩毛片在线免费看| 久久国产一区| 日韩欧美一区二| 国产av熟女一区二区三区| 日日夜夜精品网站| 国产成人在线播放| 无码人妻精品一区二区蜜桃百度| 国产精品一区二区三区在线播放| 欧美理论片在线观看| 国产色一区二区三区| 欧美激情区在线播放| 国产欧美日韩免费看aⅴ视频| 久久成人在线视频| 成人免费网站在线| 亚洲第一综合网站| 久久艳妇乳肉豪妇荡乳av| 天天干天天操天天干天天操| 国产精品88a∨| 日本一级黄视频| 日韩在线中文字幕| 韩日欧美一区二区| 欧美乱妇高清无乱码| 国产日韩一区二区在线观看| 欧美精品成人在线| 91九色在线观看视频| 日韩av高清在线看片| 国产成人啪精品视频免费网| 国内精品一区二区三区四区| 欧美激情精品久久久久久大尺度| 成人国产精品日本在线| 色噜噜狠狠色综合网| 久久久精品网站| 国产日韩一区二区| 午夜视频在线瓜伦| 精品国模在线视频| 国产精品自产拍在线观看 | 国产高清自拍一区| 欧美成人精品一区二区| 黄页网站大全在线观看| 国产精品久久久影院| 黄色录像特级片| 国产精品成人一区二区三区| 国产一区二区三区四区五区在线| 操91在线视频| 国产v亚洲v天堂无码久久久| 欧美极品少妇无套实战| 久久久久国产精品免费网站| 久久国产亚洲精品无码| 欧美日韩国产三区| www.九色.com| 午夜久久久久久久久久久| 国产原创中文在线观看| 亚洲熟妇av一区二区三区| 精品国产一区二区三区久久狼黑人 | 国产福利一区二区三区在线观看| 日韩欧美手机在线| 插插插亚洲综合网| 国产成人一区二区三区小说| 蜜臀av性久久久久蜜臀av| 亚洲熟妇av日韩熟妇在线| 久久精品国产2020观看福利| av动漫在线免费观看| 欧美一区二区影院| 亚洲a∨日韩av高清在线观看| 久久精品视频在线观看| 91精品在线播放| 国产有码在线一区二区视频| 日韩欧美在线免费观看视频| 亚洲永久在线观看| 国产精品无码一本二本三本色| 91精品综合久久久久久五月天| 免费看污污视频| 日韩一级免费在线观看| 一本一本a久久| 国产精品高潮在线| 少妇久久久久久| 久久手机在线视频| 成人免费在线小视频| 国产尤物99| 国模吧无码一区二区三区| 青青视频在线播放| 视频一区二区在线观看| 中文字幕乱码一区二区三区| 国产精品久久久久久超碰| 久久久久久久久国产| 91精品91久久久中77777老牛| 免费高清在线观看免费| 欧美日韩一区二区三区电影| 日本精品一区二区| 天天综合五月天| 亚洲精品中文综合第一页| 九九久久国产精品| 超碰91人人草人人干| 久久夜色精品国产欧美乱| 国产精品视频xxx| 久久精品一区中文字幕| 精品国产欧美成人夜夜嗨| 日韩最新av在线| www.欧美免费| 久久精品视频网站| www.日韩av.com| 色婷婷综合久久久久中文字幕1| 久久久久狠狠高潮亚洲精品| 91黄在线观看| 国产盗摄xxxx视频xxx69| 国产成人综合久久| 久久久久久久激情| 日韩一二三在线视频播| 精品国产自在精品国产浪潮| 久久久久北条麻妃免费看| 精品国内亚洲在观看18黄| 国产精品日日做人人爱| 国产精品劲爆视频| 久久国产精品久久精品| 一本色道久久99精品综合| 欧美极品第一页| 亚洲日本精品国产第一区|