成a人片国产精品_色悠悠久久综合_国产精品美女久久久久久2018_日韩精品一区二区三区中文精品_欧美亚洲国产一区在线观看网站_中文字幕一区在线_粉嫩一区二区三区在线看_国产亚洲欧洲997久久综合_不卡一区在线观看_亚洲欧美在线aaa_久久99精品国产_欧美卡1卡2卡_国产精品你懂的_日韩精品91亚洲二区在线观看_国内一区二区视频_91丨国产丨九色丨pron

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人片国产精品_色悠悠久久综合_国产精品美女久久久久久2018_日韩精品一区二区三区中文精品_欧美亚洲国产一区在线观看网站_中文字幕一区在线_粉嫩一区二区三区在线看_国产亚洲欧洲997久久综合_不卡一区在线观看_亚洲欧美在线aaa_久久99精品国产_欧美卡1卡2卡_国产精品你懂的_日韩精品91亚洲二区在线观看_国内一区二区视频_91丨国产丨九色丨pron
    东方aⅴ免费观看久久av| 99视频精品免费视频| 国产在线视频不卡二| 色婷婷综合久久| 久久免费看少妇高潮| 日韩激情在线观看| 日本韩国欧美国产| 国产精品免费视频网站| 久久国产精品第一页| 欧美色综合网站| 中文字幕字幕中文在线中不卡视频| 国产一区二区精品久久| 6080国产精品一区二区| 一片黄亚洲嫩模| 91色综合久久久久婷婷| 国产欧美精品一区二区色综合朱莉 | 一本色道久久综合亚洲精品按摩| 国产亚洲成aⅴ人片在线观看| 另类专区欧美蜜桃臀第一页| 56国语精品自产拍在线观看| 偷窥少妇高潮呻吟av久久免费| 欧美无砖砖区免费| 亚洲伊人伊色伊影伊综合网| 色88888久久久久久影院野外| 亚洲视频一区在线观看| 色综合久久久久网| 玉米视频成人免费看| 91久久久免费一区二区| 亚洲午夜精品17c| 欧美三级视频在线观看| 午夜精品爽啪视频| 欧美乱妇23p| 日本不卡的三区四区五区| 日韩三级中文字幕| 久久精品国产一区二区| 欧美成人女星排行榜| 久久99精品久久久久久久久久久久 | 精品国产一区久久| 国产一区二区伦理| 欧美激情一区不卡| www.综合网.com| 亚洲免费观看高清完整版在线观看熊 | 国产成人精品亚洲午夜麻豆| 国产亚洲综合色| 丰满放荡岳乱妇91ww| 国产精品成人免费| 色哟哟国产精品| 亚洲国产中文字幕在线视频综合| 欧美日韩国产天堂| 麻豆精品一二三| 久久久久久久久免费| 不卡影院免费观看| 一区二区三区在线视频观看58| 日本韩国欧美国产| 日韩中文字幕麻豆| 久久综合色8888| 成人黄色免费短视频| 依依成人精品视频| 69av一区二区三区| 国产一区二区美女诱惑| 中文字幕一区三区| 欧美性生交片4| 喷水一区二区三区| 国产日韩精品一区二区浪潮av | 欧美精品一区二区三区高清aⅴ | 亚洲成av人**亚洲成av**| 欧美一级一区二区| 国产精品456| 亚洲欧美另类小说| 欧美肥大bbwbbw高潮| 韩国女主播成人在线| 国产精品久久久久久久久动漫 | 久久免费视频色| 成人动漫一区二区三区| 亚洲另类中文字| 91精品国产免费| 大胆欧美人体老妇| 亚洲国产wwwccc36天堂| 欧美精品一区二区三| 色综合久久久网| 美国十次了思思久久精品导航| 国产女人aaa级久久久级| 色婷婷综合中文久久一本| 蜜臀久久99精品久久久画质超高清| 日本一区二区三区免费乱视频 | 亚洲欧洲日产国码二区| 欧美三片在线视频观看| 国内精品伊人久久久久av影院| 综合av第一页| 日韩欧美不卡一区| 99久久久久免费精品国产 | 国产精品影音先锋| 亚洲黄色免费网站| 日韩欧美一区二区不卡| av午夜精品一区二区三区| 欧美aaaaaa午夜精品| 日韩一区在线免费观看| 欧美大胆一级视频| 91国偷自产一区二区三区成为亚洲经典 | 国产精品传媒入口麻豆| 欧美一区二区在线看| 99精品桃花视频在线观看| 美女高潮久久久| 亚洲精品videosex极品| www一区二区| 欧美系列亚洲系列| 成人黄色软件下载| 麻豆精品视频在线观看免费| 亚洲欧美另类久久久精品| 久久人人爽爽爽人久久久| 欧美网站大全在线观看| 不卡av免费在线观看| 久久精品国产成人一区二区三区| 伊人夜夜躁av伊人久久| 中文字幕免费观看一区| 欧美大片在线观看一区二区| 欧美性欧美巨大黑白大战| 成人精品国产免费网站| 久久成人免费日本黄色| 亚洲午夜日本在线观看| 亚洲欧洲在线观看av| 国产丝袜在线精品| 欧美成人精品1314www| 日韩精品免费专区| 中文字幕中文乱码欧美一区二区| 欧美岛国在线观看| 欧美男人的天堂一二区| 日本韩国欧美在线| 成人福利视频网站| 国产精品一级二级三级| 日韩电影免费在线| 一区二区三区波多野结衣在线观看| 国产欧美一区二区三区网站| 精品国精品自拍自在线| 91精品国产入口| 欧美日本乱大交xxxxx| 在线一区二区三区四区五区| 成人高清免费在线播放| 国产成a人亚洲精品| 狠狠色丁香久久婷婷综| 免费观看91视频大全| 石原莉奈在线亚洲二区| 亚洲国产一区二区视频| 樱花草国产18久久久久| 亚洲人精品一区| 中文字幕亚洲视频| 国产精品欧美一区二区三区| 国产日韩欧美综合一区| 久久综合av免费| 精品女同一区二区| 日韩精品一区二区三区swag| 欧美一区二区在线播放| 9191久久久久久久久久久| 欧美三级中文字幕在线观看| 欧美曰成人黄网| 日本精品一级二级| 色综合久久99| 91黄色小视频| 欧美无砖专区一中文字| 欧美手机在线视频| 欧美天堂亚洲电影院在线播放| 欧美性videosxxxxx| 欧美日韩亚洲高清一区二区| 欧美日韩精品一区视频| 欧美久久高跟鞋激| 91麻豆精品国产91久久久使用方法 | 久久一区二区三区四区| 久久综合九色综合欧美亚洲| 欧美r级电影在线观看| 精品国产一区二区三区四区四| 欧美videofree性高清杂交| 精品日韩av一区二区| 精品福利一区二区三区免费视频| 26uuu国产在线精品一区二区| 久久久亚洲精品石原莉奈| 国产偷国产偷亚洲高清人白洁| 欧美国产精品专区| 中文字幕亚洲成人| 亚洲自拍与偷拍| 日本三级亚洲精品| 国产曰批免费观看久久久| 国产成人免费视| k8久久久一区二区三区 | 国产精品久久久久久久裸模| 国产精品国产三级国产a| 亚洲欧美日韩国产手机在线| 一卡二卡欧美日韩| 亚洲成a人v欧美综合天堂| 日本不卡高清视频| 国产乱子伦视频一区二区三区 | 懂色av一区二区三区蜜臀| eeuss国产一区二区三区| 色哟哟一区二区| 欧美精品777| 欧美xingq一区二区| 亚洲国产精品成人久久综合一区| 亚洲人成网站在线| 午夜视频在线观看一区二区三区| 久久9热精品视频| 成人国产精品免费网站|