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

合肥生活安徽新聞合肥交通合肥房產(chǎn)生活服務(wù)合肥教育合肥招聘合肥旅游文化藝術(shù)合肥美食合肥地圖合肥社保合肥醫(yī)院企業(yè)服務(wù)合肥法律

CS4121代做、代寫C++語言編程
CS4121代做、代寫C++語言編程

時間:2025-06-06  來源:合肥網(wǎng)hfw.cc  作者:hfw.cc 我要糾錯



CS4121 Cminus Expression Evaluation Compiler Project

Due Date: Tuesday, June. 3, 2025 at11:59 am

Purpose

The purpose of this project is to gain experience in giving meaning to a programming language by generating

Mips assembly for a subset of Cminus. Specifically, you will be generating assembly for integer I/O operations,

integer arithmetic and logical expressions and assignment statements.

Project Summary

In this project, you will add actions to a parser provided by me. You must add code to do the following:

1. Assign space for global and local integer variables declared in a Cminus program.

2. Generate assembly pseudo-ops for string constants used in a Cminus program.

3. Generate assembly to print string constants.

4. Generate assembly to print integers.

5. Generate assembly to read integers.

6. Generate assembly to compute integer expressions.

7. Generate assembly to compute logic expressions.

8. Generate assembly to assign values to integer variables.

Prologue and Epilogue Code

Since you are converting a Cminus program to Mips assembly, you must begin each assembly file with any

data declarations and a declaration of where themainprogram begins. This is done with the following code:

.data

.newl: .asciiz "\n"

.text

.globl main

main: nop

This code declares a data section with a string.newlthat is just the newline character, followed by a text

section (instructions) containing a declaration of the main routine. Each Mips assembly file should begin

with this sequence. Any space that you allocate for strings or floating-point constants in the static data area

may be allocated with directives after the   .data   directive and before the   .text   directive.

Assigning Variable Space

Memory for global variables declared in a Cminus program will be address as an offset off of$gp. The

register$gppoints to the middle of a 64K region in the static data area. You may address this area as a

positive or negative offset off of$gp. I will guarantee that you will need no more than 64K of space in the

static data area for any input program for any of the projects in this class.

Memory for local variables is allocated on the stack. Each integer requires four bytes of space. Local space

is allocated by adjusting the stack pointer the requisite number of bytes. Since stacks grow in the negative

direction in memory, space is allocated by subtracting from the stack pointer. The Cminus declarations

1

int i,j,k;

require 12 bytes of space. That space is allocated on the stack with the instructions

sw $fp, ($sp)

move $fp, $sp

sub $sp, $sp, 12

which should be placedimmediatelyfollowing the prologue code. The first instruction stores the old frame

pointer. The second sets the new frame pointer,$fp, and the third instruction allocates the space for the 3

variables.

String Constants

A Cminus program may use string constants in write statements. These constants are declared in the data

section using the.asciizpseudo-op. For the Cminus statement,

write(  Hello  );

The following declaration must be added to the data section of the assembly file:

.string0: .asciiz "Hello"

The label.string0is implementation dependent. You may name your string constants however you wish.

Printing Strings

Printing strings requires using a system call. The system call service for printing strings is 4. Since a

character string is stored in memory, you must pass the address of the string to the system call in register

$a0. As an example, the code to implement thewritestatement in the previous section would be:

la $a0, .string0

li $v0, 4

syscall

Note that you will need to additionally print the newline character when printing any data.

Printing Integers

Printing integers is similar to printing strings except that the actual integer is passed to the system call

rather than an address and the system call service is 1. As an example, to implement the statement:

write(7);

the following Mips assembly would need to be generated:

li $a0, 7

li $v0, 1

syscall

Reading Integers

To read an integer, the system call service is 5. The read value is returned in register$v0. Thus, to read an

integer, the following instructions are needed:

li $v0, 5

syscall

2

Accessing Variables

You may access local variables by loading them from an offset of the frame pointer ($fp). As an example,

assuming that the variableais assigned the second 4 bytes of local space. The following code might be

generated to accessa:

sub $s0, $fp, 4

lw $s1, 0($s0)

Loading a global variable is similar except that we use$gpinstead of$fp. Ifais a global variable that is

store 8 bytes (in the positive direction) off of$gp, the following code might be generated to access it:

add $s0, $gp, 8

lw $s1, 0($s0)

Integer Arithmetic Expressions

In Mips assembly, all operations are done on registers. The best way to generate code is to store all interme-

diate values in Mips registers. Using the registers$s0, ..., $s7,$t0, ..., $t9should be sufficient. You

should not need any other temporary registers. For an operation, the operands should all be put into regis-

ters, a result register should be allocated, the operations should be performed and then the input registers

should be released to be reused later. As an example, the statement

write(a+b);

might result in the code (ifais the first declared variable andbis the second)

lw $s1, 0($fp)

sub $s0, $fp, 4

lw $s2, 0($s0)

add $s3, $s1, $s2

move $a0, $s3

li $v0, 1

syscall

Logic Expressions

Logic expressions are similar to arithmetic expressions. For the mips, the value forfalseis 0 and the value

fortrueis 1.

Storing Integer Variables

To store a value in a variable, first compute the address and then store the value into that location. For

example, the statement

a = 5;

could be implemented with

li $s0, 5

sub $s1, $fp, 4

sw $s0, 0($s1)

3

Exiting the Program

Theexitstatement in Cminus can be implemented in Mips assembly as follows:

li $v0, 10

syscall

These instructions call the system routine that exits a program. Everymainroutine in a Cminus program

will end in anexitstatement.

Requirements

Write all of your code in C or C++ . It will be tested on a CS machine and MUST work there. You will

receive no special consideration for programs which   work   elsewhere, but not on a CS machine.

Input.The fileCminusProject2.tgzcontains the parser need to begin this project. You will need to

modifiy the actions in the project fileparser/CminusParser.yto do this project. Currently, the actions

just emit the rules that are reduced. Sample input for this project is provided in the project directoryinput.

To run your compiler, use the command

cmc .cm

To execute the resulting assembly file, use the Mars simulator(http://courses.missouristate.edu/KenVollmar/mars/).

Submission.Your code should be well-documented. You will submit all of your files, by tarring up your

project directory using the command

tar -czf CminusProject2.tgz CminusProject2

Submit the fileCminusProject2.tgzvia the CS4121 Canvas page. Make sure you do a   make clean   of your

directory before executing the tar command. This will remove all of the   .o   files and make your tar file much

smaller.

Data Structures and DocumentationI have provided several C data structures for those who will

be programming in C. There are doubly linked list, symbol table and string manipulation routines in the

workspace directoryCminusProject2/util. The HTML Doxygen documentation for the provided code

is inCminusProject1/Documentation/html/index.html. You may ask me any questions regarding these

routines. You will not likely need any of these structures now, but you may want to familiarize yourself with

them. For those coding in C++, you may use STL.

codegen directoryI have created the codegen directory where the codegen.*, reg.* and other files are

store. You will add fuctions to generate instructions for different productions in parser and these functions

are in codegen.c. In addition, the register allocation management untily implimenation files are reg.c and

reg.h, which makes you use registers simple. Before generatging the compiler, you need issue make command

under the codegen direcetory.

Makefile StructureThe Makefiles for the project are set up to automatically generate make dependences.

In a particular directory (e.g.,parser), you may add new files for compilation by adding the source file name

to theSRCSvariable declaration on the first line of that directory  sMakefile. For example, to add the file

newfile.cto be compiled in theparserdirectory, change the first line ofparser/Makefilefrom

SRCS = CminusScanner.c CminusParser.c

4

to

SRCS = CminusScanner.c CminusParser.c newfile.c

Nothing else needs to be done. Do not add source files to the root directoryCminusProject2as the make

files assume there are no source files in that directory.

If you would like to add your own subdirectory (e.g.,newdir) toCminusProject2, then change the line

DIRS = parser util

inCminusProject1/Makefileto

DIRS = parser util newdir

and the line

LIBS = parser/libparser-g.a util/libutil-g.a

inCminusProject1/Makefileto

LIBS = parser/libparser-g.a util/libutil-g.a newdir/libnewdir-g.a

Then, copyutil/Makefiletonewdir/Makefile. Finally, change theSRCSdeclaration innewdir/Makefile

to contain only the source files in that directory and change the line

請加QQ:99515681  郵箱:99515681@qq.com   WX:codinghelp




 

掃一掃在手機(jī)打開當(dāng)前頁
  • 上一篇:欣欣花客服電話官方教你一招成功上岸!
  • 下一篇:關(guān)于花生米強(qiáng)制下款-如何聯(lián)系客服解決問題
  • 無相關(guān)信息
    合肥生活資訊

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

    關(guān)于我們 | 打賞支持 | 廣告服務(wù) | 聯(lián)系我們 | 網(wǎng)站地圖 | 免責(zé)聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 hfw.cc Inc. All Rights Reserved. 合肥網(wǎng) 版權(quán)所有
    ICP備06013414號-3 公安備 42010502001045

    国产人妻人伦精品_欧美一区二区三区图_亚洲欧洲久久_日韩美女av在线免费观看
    日韩欧美视频网站| 国产日本欧美在线| 日日摸天天爽天天爽视频| 欧美日韩免费观看一区| 精品免费一区二区三区蜜桃| www.久久草| 精品国内自产拍在线观看| 久久99热精品| 欧美伊久线香蕉线新在线| 成人h视频在线观看| 国产精品视频精品| 日韩av大片在线| 国产视频一区二区三区四区| 成人精品久久一区二区三区| 国产成人久久777777| 日韩有码免费视频| 国产伦精品一区二区三区免| 久久国产主播精品| 久久这里只有精品99| 人人澡人人澡人人看欧美| 99视频免费观看| 久久99亚洲精品| 欧美日韩亚洲免费| 69av在线播放| 亚洲蜜桃av| 97久久伊人激情网| 久久久久国产视频| 国模精品视频一区二区| 成人动漫在线观看视频| 久久精品这里热有精品| 日本免费一级视频| 免费av在线一区二区| 久久精品国产v日韩v亚洲| 日本在线精品视频| 成人h视频在线观看| 国产精品爽爽ⅴa在线观看| 日本一区二区三区四区高清视频| 成人综合国产精品| 精品久久久久久无码国产| 欧美精品二区三区四区免费看视频 | 国产福利一区二区三区在线观看| 久久亚洲影音av资源网| 欧美在线视频一区二区三区| 久久久久天天天天| 国产精品久久久91| 国产大片精品免费永久看nba| 日韩av在线一区二区三区| 国产传媒欧美日韩| 国产乱码精品一区二区三区卡| 国产二区视频在线| 国产精品久久久久av免费| 欧美亚洲日本网站| 久久黄色av网站| 男女猛烈激情xx00免费视频| 国产精品欧美在线| 日韩一区不卡| 久操网在线观看| 青青青在线观看视频| 国产成人精品亚洲精品| 国内精品模特av私拍在线观看| 国产精品青青草| 国产欧美日韩在线播放| 在线一区亚洲| 国产精品678| 日韩免费毛片| 久热精品视频在线观看一区| 麻豆av福利av久久av| 中文字幕人成一区| 国产精品aaaa| 欧美第一黄网| 国产精品成熟老女人| 国产午夜伦鲁鲁| 久久久久天天天天| 国产乱码精品一区二区三区不卡| 国产99久久精品一区二区 | 国产精品12345| 日本a在线天堂| 国产精品福利观看| 成人免费观看a| 日本亚洲欧洲色α| 美日韩精品免费观看视频| 国产成人激情小视频| 国产欧美一区二区视频| 日韩精品手机在线观看| 亚洲欧洲一区二区在线观看| 国产精品久久久久久av下载红粉| 国产suv精品一区二区三区88区| 国产欧美日韩综合精品二区| 青青视频免费在线观看| 亚洲欧洲三级| 美女999久久久精品视频| 久久久久久亚洲精品| 福利精品视频| 春日野结衣av| 欧美激情综合色| 国产精品欧美日韩| 久久久久久久久久久久av| 97碰碰碰免费色视频| 国产欧美日韩中文字幕在线| 妓院一钑片免看黄大片| 午夜精品一区二区在线观看的| 久久99热这里只有精品国产| 国产精品久久97| 国产精品免费一区豆花| y97精品国产97久久久久久| 国产成人精品免高潮在线观看| 97精品视频在线观看| 国产欧美一区二区三区视频| 狠狠色狠狠色综合人人| 日韩人妻精品一区二区三区| 亚洲18私人小影院| 亚洲视频在线观看日本a| 欧美成人精品一区二区三区| 国产精品久久久av| 国产精品久久精品| 国产精品入口尤物| 精品久久久91| 久久精视频免费在线久久完整在线看 | 国产精品久久久久久久久久久新郎 | 日韩有码在线视频| 久久久久久美女| 久久久久久一区二区三区| 国产成人精品免费看在线播放| 91精品国产高清久久久久久| 91久久精品美女| 97伦理在线四区| 91精品视频在线播放| 91免费在线视频| 久久久无码中文字幕久...| 91.com在线| 国产二级片在线观看| 久久国产亚洲精品无码| 久久99精品久久久久子伦| 久久99蜜桃综合影院免费观看| 日韩在线免费视频观看| 日韩中文字幕亚洲| 国产精品日韩在线| 国产精品国产三级国产专区53 | 欧美日韩国产综合在线| 日本国产中文字幕| 欧美午夜小视频| 黄色av免费在线播放| 免费看日b视频| 国产伦精品一区二区三区四区视频 | 青青草视频在线视频| 免费在线观看一区二区| 国产一区二区丝袜高跟鞋图片| 国产一区二区免费在线观看| 国产精品尤物福利片在线观看| 91久久久亚洲精品| 久久久久久久久久久久久9999 | av网址在线观看免费| 欧美综合一区第一页| 欧美激情伊人电影| 欧美xxxx14xxxxx性爽| 亚洲午夜精品久久久中文影院av| 亚州国产精品久久久| 日韩亚洲欧美一区二区| 免费看污久久久| 91久久国产自产拍夜夜嗨| 国产高清精品一区二区三区| www.欧美精品| 欧美精品手机在线| 春日野结衣av| 黄色国产精品一区二区三区| 国产日产欧美a一级在线| 91久久久久久久一区二区| 精品国产欧美一区二区五十路| 精品国产第一页| 日韩av电影在线播放| 国产在线精品一区二区中文| 97人人干人人| 国产精品入口尤物| 亚洲日本理论电影| 日韩精品―中文字幕| 国产精品一级久久久| 北条麻妃99精品青青久久| 一区二区三区免费看| 欧美一区二区在线| av免费精品一区二区三区| 日韩在线小视频| 在线视频不卡国产| 欧美亚洲激情在线| 91精品国产亚洲| 精品久久久久久久免费人妻| 奇米成人av国产一区二区三区| 国产精品综合网站| 国产成人精品亚洲精品| 亚洲一区二区久久久久久| 精品人妻一区二区三区四区在线| 91精品视频免费观看| 久久成年人视频| 欧美亚洲另类在线一区二区三区| 99色这里只有精品| 欧美xxxx综合视频| 日本不卡高字幕在线2019| 99久热re在线精品视频| 国产精品免费成人| 日本视频精品一区| 白白操在线视频|