<samp id="e4iaa"><tbody id="e4iaa"></tbody></samp>
<ul id="e4iaa"></ul>
<blockquote id="e4iaa"><tfoot id="e4iaa"></tfoot></blockquote>
    • <samp id="e4iaa"><tbody id="e4iaa"></tbody></samp>
      <ul id="e4iaa"></ul>
      <samp id="e4iaa"><tbody id="e4iaa"></tbody></samp><ul id="e4iaa"></ul>
      <ul id="e4iaa"></ul>
      <th id="e4iaa"><menu id="e4iaa"></menu></th>

      代寫CSE 465/565 解析器 interpreter

      時間:2024-03-01  來源:  作者: 我要糾錯


      CSE 465/565

      Homework #1: 55 points

      Outcomes:

      ● Warming up by writing a java code

      ● Understand how an interpreter works

      ● Understand some of the difficulties involved in designing a new programming language.

      Scoring:

      ●   (10 pts) Successful upload on GIT. If your code is submitted on GIT successfully, the following aspects of your program will be graded

      ● (45 pts) Write an interpreter (Java or C++) to execute Z+-  programs

      ○ (10 pts) Basic structure, integer variables only

      ○ (10 pts) Basic structure, integer and string variables

      ○ (10 pts for Graduate students-20 pts for Undergraduate students) For loops

      ○ (10 pts) Nested for loops (only for graduate students)

      ○ (5 pts) Detection of runtime errors

      Requirements:

      ● Java version 17 or older. If you haven’t installed java before on your laptop, download JDK

      from here: https://www.oracle.com/java/technologies/downloads/ .You can install the latest  version which is JDK21 (if you already don’t have any java version 17 or older on your laptop), reset your computer, and it should be done.

      ●   Although you can use any IDE of your choice, Eclipse is recommended. Follow the instructions for installing and configuring Eclipse here: Install and Configure Eclipse

      ●   You must name your main class Zpm. You can create additional classes as needed, but the Zpm class should be the one containing the main method.

      ●   Your program must take a Z+- code as a file with .zpm extensions through the command line    argument. which means your program must run on a terminal (windows terminal or CMD on   windows, and terminal on mac) using the standard compile command. Naming the main class Zpm, and assuming prog.zpm is a file with Z+- codes in it:

      javac *.java

      java Zpm prog.zpm

      ●   So, your program does not prompt the user to enter a file or anything like that. Instead, it receives a file as an argument when the program is run through the terminal (as shown above), not during compilation.

      Instructions:

      (55 points) Consider a very simple programming language named Z+-. The Z+-  programming language has the following features:

      1.   Call your project on GitLab/GitHub Homework1. This folder/package should be saved inside your “CSE465_565” project on your GIT.

      2.   Z+- variables are case-sensitive and consist of one letter [A-Z]. No numbers, no special characters.

      3.   Z+- variables can store a string or integer value. A single variable can switch between integer and string values during program execution. Assigning a value to a variable creates that variable for future use.

      4.   A runtime error occurs if a variable is used before it is given a value.

      5.   The PRINT statement displays a particular variable’s value. This is done as:

      PRINT numCookies ;

      6.   The right-hand side of a simple assignment statement (i.e., =) is either a variable name (which must have a value), signed integer, or string literal. For example, the following are valid:

      A = 12 ;

      A = B ;   (B must have values)

      A = "hello" ;

      7.   There are three compound assignment statements: +=, *=,and -=.  The meaning of these operators depends on the data type of the left and right hand side of the operator.

      +=   concat right string onto end of left string

      += increment left integer with value on right

      *= multiply left integer by value on right

      -= subtract right integer from value on left

      A += 34 ;

      A *= B ;   (B must have values)

      A += "hello world" ;   (Assuming A is already holding a

      String value)

      All other combinations are illegal and cause a runtime error.

      8.    Every statement is terminated by a semi-colon.

      9.   There is a loop statement – FOR - whose body contains at least one simple statement (i.e., no nested loops), which are presented on one line. The keyword FOR is followed by an integer constant, which indicates the number of times to execute the loop. Following this number is a sequence of statements defining the loop's body, followed by the word ENDFOR.

      FOR 5 B += A ; A *= 2 ; ENDFOR

      10. Graduate Students: Graduate students should also make the Z+- language to work with nested loops:

      FOR 5 B += A ; A *= 2 ; FOR 10 A += B ; ENDFOR ENDFOR

      this could be more than one loop inside another one.

      11. Z+- programs must have at least one space separating all elements.

      12. You also need to throw an exception if the given file is not a .zpm file or no file is given.

      13. A general rule: Any line that ends with a value (e.g., "hello", 3434) or a variable (e.g., A) should conclude with a semicolon. Therefore, assignment statements and print statements must end   with a semicolon. However, for loops should conclude with 'ENDFOR'.

      Sample Run:

      1.   Here is an example Z+- program:

      A = 1 ;

      B = 0 ;

      FOR 5 B += A ; A *= 2 ; ENDFOR

      A += 1000 ;

      PRINT A ;

      PRINT B ;

      This program's output is (pay attention that there is no space in between):

      A=1032

      B=31

      2.   Here is a second Z+- program:

      A = 10 ;

      A += A ;

      PRINT A ;

      A = "hello" ;

      A += A ;

      PRINT A ;

      A += 123 ;

      PRINT A ;

      The output to this second program would be (pay attention that there is no space in between):

      A=20

      A=hellohello

      RUNTIME ERROR: line 7

      You may assume that the programs are syntactically correct but may have runtime errors (e.g., add integer and string, or doing operator on a variable that hasn't been initialized).

      When an error happens, your program should print the runtime error, and stop the program.

      Test your program:

      Come up with Z+- codes similar to the ones shown above, and test your program comprehensively.
      請加QQ:99515681  郵箱:99515681@qq.com   WX:codehelp 

      標簽:

      掃一掃在手機打開當前頁
    • 上一篇:代寫CS444 Linear classifiers
    • 下一篇:代做代寫COMPSCI 4091 Advanced Networked Systems
    • 無相關信息
      昆明生活資訊

      昆明圖文信息
      蝴蝶泉(4A)-大理旅游
      蝴蝶泉(4A)-大理旅游
      油炸竹蟲
      油炸竹蟲
      酸筍煮魚(雞)
      酸筍煮魚(雞)
      竹筒飯
      竹筒飯
      香茅草烤魚
      香茅草烤魚
      檸檬烤魚
      檸檬烤魚
      昆明西山國家級風景名勝區
      昆明西山國家級風景名勝區
      昆明旅游索道攻略
      昆明旅游索道攻略
    • NBA直播 短信驗證碼平臺 幣安官網下載 歐冠直播 WPS下載

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

      Copyright © 2025 kmw.cc Inc. All Rights Reserved. 昆明網 版權所有
      ICP備06013414號-3 公安備 42010502001045

      主站蜘蛛池模板: 亚洲?V无码成人精品区日韩| 人妻丰满?V无码久久不卡| 性色av无码不卡中文字幕| AV无码人妻中文字幕| 国产精品国产免费无码专区不卡| 无码人妻一区二区三区免费视频| 中文字幕无码一区二区免费| 亚洲AV无码成人精品区狼人影院| heyzo专区无码综合| 亚洲国产超清无码专区| 免费VA在线观看无码| 亚洲av片不卡无码久久| 亚洲精品无码永久在线观看你懂的 | 中文字幕无码高清晰| 免费无码又爽又刺激网站| 影音先锋无码a∨男人资源站| 无码AV中文字幕久久专区| 亚洲成av人片不卡无码久久| 亚洲youwu永久无码精品| 亚洲国产成人无码av在线播放 | 内射人妻少妇无码一本一道 | 亚洲AV无码一区二区一二区| 亚洲AV永久无码精品| 五月丁香六月综合缴清无码| 无码人妻精品一区二区三区9厂| 97人妻无码一区二区精品免费| 亚洲va中文字幕无码久久| 国产精品99久久久精品无码| 超清无码无卡中文字幕| 中文字幕有码无码AV| 亚洲啪啪AV无码片| 伊人久久精品无码二区麻豆| 亚洲精品无码专区2| yy111111少妇无码影院| 久久久久亚洲AV无码专区网站| 亚洲AV中文无码乱人伦在线视色 | 国产成人精品无码一区二区三区| 一本大道无码日韩精品影视_| 日韩经典精品无码一区| 国产人成无码视频在线观看| 无码精品人妻一区二区三区影院|