狠狠综合久久久久综合网址-a毛片网站-欧美啊v在线观看-中文字幕久久熟女人妻av免费-无码av一区二区三区不卡-亚洲综合av色婷婷五月蜜臀-夜夜操天天摸-a级在线免费观看-三上悠亚91-国产丰满乱子伦无码专区-视频一区中文字幕-黑人大战欲求不满人妻-精品亚洲国产成人蜜臀av-男人你懂得-97超碰人人爽-五月丁香六月综合缴情在线

SCC312代做、代寫Java編程語言

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



February 2024 1 SCC312 Compilers Coursework 23/24
SCC312 Compilers Coursework 2023/24:
Recursive Descent Recogniser
1. General Instructions
Section 3 describes a grammar for a simple programming language rather like Ada. The task is to implement a
syntax analyser (SA) for this language using a recursive descent parser. The analyser’s sole function is make sure a
user’s source program is syntactically correct, and the SA should generate appropriate and helpful error messages
where required. The SA should terminate on encountering and reporting the first error. To be more precise, you
are expected to build a Syntax Recogniser with its purpose to recognise its input as a valid sentence in the
language specified by the grammar.
The coursework task is to implement part of a compiler for this language using a recursive descent parser.
1.1. Java Classes Provided
You are provided with the following Java classes:
(a) Token in a file Token.java, to represent a token returned by the lexical analyser stage. This has:
• a set of integer constants (becomesSymbol, beginSymbol, identifier, leftParenthesis, and so on)
representing the possible types of token in this language
• three public attributes (symbol, an int, which is one of the constants declared above; text, a String,
the characters making up the token; lineNumber, an int, the number of the line containing the
token)
• two constructors, and a static method getName to return the name (a String) of a token provided
as the single int argument
(b) CompilationException in a file CompilationException.java (see below)
(c) LexicalAnalyser in a file LexicalAnalyser.java, which is the lexical analyser for this programming language.
This has:
• a constructor with one String argument, the name of the file from which the tokens are to be read
• a method getNextToken (with no arguments), to return the next token read from the source text
• a main method, with which the operation of the lexical analyser can be tried out on a suitable file
(using a toString method supplied in the Token class)
(d) AbstractGenerate in a file AbstractGenerate.java. This is the abstract class you need to make concrete in
the Generate class you have to provide.
(e) AbstractSyntaxAnalyser in a file AbstractSyntaxAnalyser.java. This is the abstract class you need to make
concrete in the SyntaxAnalyser class you have to provide.
(f) Compile in a file Compile.java. This is the driver program for the whole coursework. This driver program
calls the parse method of the SyntaxAnalyser class for each file with a name of the form "programn"
(integer n ³ 0) (these files are in the coursework pack).
These classes can be found in the coursework pack ZIP folder that this document came along with. To help you
build and run your work, as well as generate this ZIP file to submit, some shell scripts have been included:
February 2024 2 SCC312 Compilers Coursework 23/24
1.2 Building the Code
For Windows Users:
Running ‘compile.bat’ will compile all java source files
Running ‘execute.bat’ will run the compiler against all supplied test programs
For Mac/Linux Users:
A makefile has been included which has the following functions (where ‘$>’ is your terminal prompt:
$> make
Compile all required java sources
$> make run
Run the compiler against all supplied test programs
$> make package
Build a submission .zip file - this is a ‘beta’ feature, check your submission file
has been created successfully before actually submitting it!
Note; The makefile requires a working install of the following: zip, java, javac, and make to work
correctly.
1.3 Java Classes To Be Implemented
1.3.1 SyntaxAnalyser
Write a Java class SyntaxAnalyser. Your SyntaxAnalyser class must include at an appropriate place a comment
line which includes the string "author" and your name.
The AbstractSyntaxAnalyser class contains the following methods :
abstract void _statementPart_()
throws IOException, CompilationException
abstract void acceptTerminal(int symbol)
throws IOException, CompilationException
public void parse(PrintStream ps)
throws IOException
You have to extend the above class as appropriate. Please note that the parse method is provided for you.
1.3.2. Generate
The parser must make use of the Generate class, which you must also supply by extending the AbstractGenerate
class. The AbstractGenerate class contains the following methods:
public void insertTerminal(Token token);
public void commenceNonterminal(String nonTerminalName);
public void finishNonterminal(String nonTerminalName);
public void reportSuccess();
public abstract void reportError(Token token, String explanatoryMessage)
throws CompilationException;
February 2024 3 SCC312 Compilers Coursework 23/24
The parser must demonstrate its operation by calling the Generate class methods as follows:
● insertTerminal(Token token) when it has correctly read a terminal.
● commenceNonterminal(String nonTerminalName) and finishNonterminal(String nonTerminalName) when it
respectively starts and finishes reading a non-terminal. For non-terminals specified in the grammar below, the
String nonTerminalName should be that specified in the grammar (for example "<procedure list>" or
"<assignment statement>"). For new non-terminals introduced by you, the String nonTerminalName should be
of the form "<new SOMETHING>".
● the void method reportSuccess() when it has successfully parsed the file.
Use these methods in a class Generate to display a trace (using System.out.println) of the operation of the
parser.
Error recovery is not required for this parser. Instead parse should report at the first syntax error encountered,
by calling reportError(Token tokenRead, String explanatoryMessage) in the Generate class. Implement a
suitable version of this method to indicate what the next erroneous token is, what the parser is trying to
recognise at this point, and the line number where the error is recognised. The method should finish by throwing
the exception CompilationException, which should eventually be caught by the parse method in the
SyntaxAnalyser class. As the exception reaches each of your parse methods, you should use it as an opportunity
to report where in the parse tree the error occurred. Hint: Look at the constructor for CompilationException.
The parse method should return in the normal way after processing a file, whether it reports success or failure, so
that it can then be called to start to process the next file (if any).
You may include in your Generate class either or both the constructor methods Generate() and Generate(String),
but no other methods than those specified in AbstractGenerate.
You should strive to make your error messages as helpful and as accurate as possible. You should consider how
the structure of the program can be used to get context for errors. We are deliberately not providing sample
error messages res.txt file but you should consider what a programmer of the language would need. When using
if statements, if you have more than 2 branches, please use a switch statement instead.
1.4 Marking criteria
Marks will be allocated according to the following criteria. The percentages are provided to guide you as to where
to dedicate your time and should be considered indicative only.
- SyntaxAnalyser (structure, design and implementation) 50%
- Generate (methods used, implemented and extension) 10%
- For the programs in the test set: 10%
- Success on syntactically correct programs: -
- Errors on syntactically incorrect programs:
- Detailed (correct) error messages 10%
- Recursive errors (stack traces) 10%
- Code quality and comments 10%
The coursework will be checked using a two step process; first automatically using a testing framework against
our provided classes and then manually to review the quality of your error messages, code commenting and other
criteria, and then finally marked according to letter grades.
February 2024 4 SCC312 Compilers Coursework 23/24
1.5 Test Data
The source texts to be analysed can be found in the “Programs Folder” provided. The output from “program0” is
provided as a guide as to what is expected in the way of output, so there is no need to include the results of
recognizing “program0”. To make it easier to see where sections start and end, I have indented the output for
program0, but note that you are not required to do the same in your output. Note: we will not be answering
questions about which programs should throw errors or fail to compile. Feel free to create your own sample
testing programs to test partial solutions while you are developing things.
2. Submission of Work
You should submit:
Listings of the code you have written (the classes SyntaxAnalyser and Generate, suitably laid out and
commented), and all the output from running your code over test files, both output.txt and res.txt should be
submitted. If you are using Mac or Linux, the makefile will help you do this.
Please note we have provided sample output from our worked solution on “program0”; you should use this as a
guideline for the output your recogniser produces, and as a check for the results of your recogniser on
“program0”.
Deadline: 16:00 (4pm), Friday, Week 19
WARNING : You *must not* change any of the pre-supplied Java classes. The 2 classes you submit will be
compiled and tested with the pre-supplied classes. If they fail to compile or run because they depend on some
alteration you have made to the pre-supplied classes, you will receive a mark of zero. Please ensure that you test
on the SCC lab machines with the version of Java installed there.
3. Grammar Rules for part of a Simple Programming Language
<statement part> ::= begin <statement list> end
<statement list> ::= <statement> |
<statement list> ; <statement>
<statement> ::= <assignment statement> |
<if statement> |
<while statement> |
<procedure statement> |
<until statement> |
<for statement>
<assignment statement> ::= identifier := <expression> |
identifier := stringConstant
<if statement> ::= if <condition> then <statement list> end if |
if <condition> then <statement list> else <statement list> end if
<while statement> ::= while <condition> loop <statement list> end loop
<procedure statement> ::= call identifier ( <argument list> )
<until statement> ::= do <statement list> until <condition>
February 2024 5 SCC312 Compilers Coursework 23/24
<for statement> ::= for ( <assignment statement> ; <condition> ; <assignment
statement> ) do <statement list> end loop
<argument list> ::= identifier |
 <argument list> , identifier
<condition> ::= identifier <conditional operator> identifier |
identifier <conditional operator> numberConstant |
identifier <conditional operator> stringConstant
<conditional operator> ::= > | >= | = | /= | < | <=
<expression> ::= <term> |
<expression> + <term> |
<expression> - <term>
<term> ::= <factor> | <term> * <factor> | <term> / <factor>
<factor> ::= identifier | numberConstant | ( <expression> )
An "identifier" is a sequence of one or more letters (a to z, A to Z) and digits (0 to 9), starting with a letter, and
excluding all the reserved words shown in bold above (procedure, is, integer, etc). Have a look at the
initialiseScanner method in LexicalAnalyser.java.
A "numberConstant" is a sequence of one or more digits (in which case it is of type "integer"), perhaps followed
by a decimal point and one or more digits (in which case it is of type "float"). A "stringConstant" is a sequence of
one or more printable characters (except ") with a " character at each end. Comments start with the symbol --
and terminate at the end of the line.
The distinguished symbol is <statement part>.
This simple language has no boolean or character data types; no arrays or records; no functions; the actual
parameters of all procedures must be identifiers, and are called by reference; only simple boolean expressions
(no not, and or or); only simple numerical expressions (no unary minus).
The grammar as written is not LL(1); it has left-recursive rules of the form:
<X list> ::= <X> | <X list> separator <X>
and rules of the form:
<something> ::= a X b | a Y g
where a, b and g are strings of terminals and/or non-terminals (a non-null) and X and Y are different
請加QQ:99515681  郵箱:99515681@qq.com   WX:codehelp 

 

標簽:

掃一掃在手機打開當前頁
  • 上一篇:代寫DTS304TC、代做Java/c++程序語言
  • 下一篇:代做COMP27112、代寫Java語言程序
  • 無相關信息
    昆明生活資訊

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

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

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

    狠狠综合久久久久综合网址-a毛片网站-欧美啊v在线观看-中文字幕久久熟女人妻av免费-无码av一区二区三区不卡-亚洲综合av色婷婷五月蜜臀-夜夜操天天摸-a级在线免费观看-三上悠亚91-国产丰满乱子伦无码专区-视频一区中文字幕-黑人大战欲求不满人妻-精品亚洲国产成人蜜臀av-男人你懂得-97超碰人人爽-五月丁香六月综合缴情在线
  • <dl id="akume"></dl>
  • <noscript id="akume"><object id="akume"></object></noscript>
  • <nav id="akume"><dl id="akume"></dl></nav>
  • <rt id="akume"></rt>
    <dl id="akume"><acronym id="akume"></acronym></dl><dl id="akume"><xmp id="akume"></xmp></dl>
    一级做a爱视频| а 天堂 在线| 欧美一级在线看| www.一区二区.com| 国产毛片久久久久久| 成人免费黄色av| 免费看又黄又无码的网站| 99中文字幕在线观看| 91看片淫黄大片91| 久久这里只有精品23| 无码粉嫩虎白一线天在线观看 | 伊人网在线免费| 亚洲av首页在线| 99视频在线免费播放| 97成人在线免费视频| 日韩人妻精品无码一区二区三区| 免费观看美女裸体网站| 久久婷婷国产精品| 亚洲精品第三页| 国产精品秘入口18禁麻豆免会员| 日批视频在线免费看| www.激情小说.com| 强开小嫩苞一区二区三区网站| 每日在线观看av| 性生交免费视频| 97超碰国产精品| 午夜免费看视频| 久久99中文字幕| 精品一区二区成人免费视频| 日本丰满少妇黄大片在线观看| 内射国产内射夫妻免费频道| 日本77777| 日韩肉感妇bbwbbwbbw| 国产91视频一区| 国产乱码一区二区三区四区| 播放灌醉水嫩大学生国内精品| 特色特色大片在线| www.日本一区| 中文字幕第36页| 精品一区二区中文字幕| 国产自产在线视频| 黄色一级片免费播放| 国内av一区二区| 中文字幕 日韩 欧美| 99草草国产熟女视频在线| 国内精品在线观看视频| 精品人妻大屁股白浆无码| 无码人妻aⅴ一区二区三区日本| 日韩av片网站| av亚洲天堂网| 黄色a级三级三级三级| 亚洲图片 自拍偷拍| 欧美大片久久久| 日韩不卡一二区| 国产午夜精品视频一区二区三区| 裸体裸乳免费看| 亚洲免费视频播放| 精品国产av无码一区二区三区| 精品成在人线av无码免费看| 狠狠干视频网站| 啊啊啊一区二区| 天堂av8在线| 男人草女人视频| www.日日操| 真实国产乱子伦对白视频| 日韩精品视频一区二区在线观看| 欧美国产日韩激情| 国产综合免费视频| 99精品一级欧美片免费播放| 男人添女人荫蒂免费视频| 亚州精品一二三区| 国产乱淫av片杨贵妃| 午夜一区二区视频| 中文字幕日本最新乱码视频| 亚洲第一页在线视频| 能看的毛片网站| 日韩伦理在线免费观看| 亚洲黄色片免费| 日本特黄a级片| 国产超级av在线| 黄色国产一级视频| 97超碰免费观看| 99精品视频网站| 亚洲第一天堂久久| 亚洲精品自拍网| 在线看的黄色网址| 欧美日韩在线成人| 国产视频一区二区视频| av动漫在线观看| 不要播放器的av网站| 久久人妻精品白浆国产| 无码精品国产一区二区三区免费| 国产乱子伦农村叉叉叉| 精品少妇在线视频| 777米奇影视第四色| 日日碰狠狠躁久久躁婷婷| 天堂在线资源视频| 欧美一级特黄a| 亚洲天堂一区二区在线观看| 国产无遮挡猛进猛出免费软件| 粉色视频免费看| 欧美专区第二页| 欧美精品久久久久久久免费| 国产乱子夫妻xx黑人xyx真爽| 国产精品免费成人| 在线观看视频在线观看| 真实国产乱子伦对白视频| 欧美日韩在线一| 国产小视频精品| 国产中文字幕乱人伦在线观看| av免费观看网| 亚洲区成人777777精品| 国产日韩欧美精品在线观看| www.激情小说.com| 男女激情免费视频| 一级做a免费视频| 国产午夜福利100集发布| 国产精品探花在线播放| 日韩视频第二页| www.国产在线播放| www.夜夜爽| heyzo国产| 欧美在线观看黄| 992kp免费看片| 男女男精品视频站| 午夜免费精品视频| av天堂永久资源网| 国产网站免费在线观看| 中文字幕在线乱| 日本一区二区免费高清视频| 成年网站免费在线观看| 欧美激情第3页| 日本黄大片一区二区三区| 少妇性l交大片| 自拍偷拍 国产| 天堂av.com| 女人帮男人橹视频播放| 轻点好疼好大好爽视频| 国产 欧美 日本| 国产女大学生av| 成年人视频网站免费观看| 亚洲国产精品久久久久爰色欲| koreanbj精品视频一区| 1024av视频| 思思久久精品视频| 欧美人与动牲交xxxxbbbb| 蜜臀av无码一区二区三区| 欧美综合在线播放| 久久久国产欧美| 18视频在线观看娇喘| 三日本三级少妇三级99| 美女av免费观看| 欧美日韩精品区别| 韩国日本美国免费毛片| 国产福利一区视频| 想看黄色一级片| 国产99久久九九精品无码| 久久99999| 成人一级生活片| 香蕉视频999| 欧美在线观看成人| 亚洲网中文字幕| 国产熟女高潮视频| 中文字幕人妻熟女人妻洋洋| 自拍偷拍一区二区三区四区| 免费看黄在线看| 玖玖精品在线视频| 中文av一区二区三区| 欧美日韩亚洲一| www.国产在线视频| 久久久久久久免费视频| 免费看污污网站| 91蝌蚪视频在线观看| 久久免费视频3| 欧美一级视频免费看| 国产精品久久久影院| 一级片免费在线观看视频| 做a视频在线观看| 中文字幕色网站| 天天干天天曰天天操| 一路向西2在线观看| 999在线观看| 国产精品波多野结衣| 国产高清免费在线| 日韩一区二区高清视频| 日韩一级性生活片| 国产91在线视频观看| 91淫黄看大片| av电影一区二区三区| 无码人妻精品一区二区蜜桃网站| 国产日韩视频在线播放| 美女扒开大腿让男人桶| 国产淫片免费看| 欧美一级小视频| 777av视频| 亚洲一区二区三区四区精品| 黄色激情在线视频| 三级在线视频观看| 黄色三级中文字幕| 国产激情在线观看视频|