美女扒开腿免费视频_蜜桃传媒一区二区亚洲av_先锋影音av在线_少妇一级淫片免费放播放_日本泡妞xxxx免费视频软件_一色道久久88加勒比一_熟女少妇一区二区三区_老司机免费视频_潘金莲一级黄色片_精品国产精品国产精品_黑人巨大猛交丰满少妇

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 

 

標(biāo)簽:

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

    昆明圖文信息
    蝴蝶泉(4A)-大理旅游
    蝴蝶泉(4A)-大理旅游
    油炸竹蟲
    油炸竹蟲
    酸筍煮魚(雞)
    酸筍煮魚(雞)
    竹筒飯
    竹筒飯
    香茅草烤魚
    香茅草烤魚
    檸檬烤魚
    檸檬烤魚
    昆明西山國家級風(fēng)景名勝區(qū)
    昆明西山國家級風(fēng)景名勝區(qū)
    昆明旅游索道攻略
    昆明旅游索道攻略
  • 短信驗證碼平臺 理財 WPS下載

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

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

    美女扒开腿免费视频_蜜桃传媒一区二区亚洲av_先锋影音av在线_少妇一级淫片免费放播放_日本泡妞xxxx免费视频软件_一色道久久88加勒比一_熟女少妇一区二区三区_老司机免费视频_潘金莲一级黄色片_精品国产精品国产精品_黑人巨大猛交丰满少妇
    任你躁av一区二区三区| www.88av| 国精产品一区二区三区| 国产97免费视频| 色婷婷av777| 国产女人被狂躁到高潮小说| 久久亚洲AV成人无码国产野外| 天天操天天干天天操天天干| 黄色免费看视频| 久久嫩草捆绑紧缚| 日韩一区二区a片免费观看| 最好看的中文字幕| xxxx日本少妇| 久久久久亚洲无码| 久久精品国产亚洲av久| 玖玖爱在线精品视频| 在线观看欧美一区二区| 国产67194| 韩国三级与黑人| 中文字幕久久久久久久| 色婷婷狠狠18禁久久| 亚洲AV成人精品| 国产成人精品一区二区三区在线观看| 人人艹在线视频| 精品一区二区三孕妇视频| 亚洲最大成人网站| 可以免费看av的网址| 国产黄在线免费观看| 国产成人无码aa精品一区| 九九热最新地址| 唐朝av高清盛宴| 国产福利在线观看视频| 深爱五月激情网| 五月婷婷婷婷婷| 成人免费看片载| 亚洲AV成人无码网站天堂久久| 精品国产国产综合精品| 999久久久国产| av在线免费观看不卡| 91传媒理伦片在线观看| 日本一卡二卡在线播放| 国产一区二区播放| 动漫av在线免费观看| 成人黄色a级片| 亚洲av无码一区东京热久久| 日本理论中文字幕| 免费在线观看黄色小视频| 亚洲无人区码一码二码三码| 成年人视频软件| 成人免费看aa片| 少妇丰满尤物大尺度写真| 国产亚洲色婷婷久久99精品91| 少妇视频一区二区| 粉嫩av懂色av蜜臀av分享| 午夜剧场免费在线观看| 强伦人妻一区二区三区| 三级影片在线看| 51妺嘿嘿午夜福利| 中文字幕18页| 免费看三级黄色片| 精品成人无码一区二区三区| 国偷自产av一区二区三区麻豆| 国产美女精品久久| 黄色av网址在线观看| 巨乳女教师的诱惑| 人人爽人人爽人人片| 欧美色图亚洲激情| 艳妇乳肉豪妇荡乳xxx| 国产又粗又猛又爽又黄| 波多野结衣不卡视频| 国产三级aaa| 欧美三级视频网站| 亚洲精品91在线| 大吊一区二区三区| 欧美性生给视频| 人人艹在线视频| 91麻豆免费视频网站| 26uuu成人网| youjizz.com国产| 三级男人添奶爽爽爽视频| 岛国精品资源网站| 国产精品一区二区人妻喷水| 久久久久久久无码| 熟女少妇内射日韩亚洲| 潘金莲一级黄色片| 美女流白浆视频| 漂亮人妻被黑人久久精品| 国产精品一区二区入口九绯色| 国产在线观看无码免费视频| 伊人网在线视频观看| 国产一区在线观看免费| aaaaa黄色片| 三上悠亚影音先锋| 激情高潮到大叫狂喷水| 稀缺呦国内精品呦| 最近中文字幕免费| 91嫩草|国产丨精品入口| 中文字幕亚洲日本| 成人国产精品久久久网站| 老熟妇高潮一区二区三区| 美女露出粉嫩尿囗让男人桶| 亚洲aaa视频| 老鸭窝一区二区| 国产精品 欧美激情| 鲁大师私人影院在线观看| 中文字幕美女视频| 欧美图片第一页| 韩国三级在线播放| 亚洲毛片亚洲毛片亚洲毛片| 日本精品一二三区| 中日韩一级黄色片| 日韩一级av毛片| 国产精品无码毛片| 91丨porny丨九色| 激情五月深爱五月| 一色道久久88加勒比一| 国产人妻人伦精品1国产丝袜| 国产一区二区三区在线视频观看| 人妻丰满熟妇aⅴ无码| 日本人妻一区二区三区| 国产三级精品三级观看| 免费视频91蜜桃| 四虎永久免费在线观看| 天天插天天射天天干| 成人在线电影网站| 99久久综合网| 欧美三级日本三级| 欧美偷拍第一页| 国产精品白丝喷水在线观看| 黄色香蕉视频在线观看| 成人在线观看高清| 高h视频免费观看| 四虎国产精品免费| 亚洲av无码成人精品区| 日韩精品人妻中文字幕有码| 亚洲美女高潮久久久| 免费的av网站| 午夜时刻免费入口| 日本性高潮视频| 91ts人妖另类精品系列| 亚洲怡红院在线观看| 亚洲少妇一区二区| 午夜不卡久久精品无码免费| 国产麻豆天美果冻无码视频| 色欲AV无码精品一区二区久久 | 一区二区三区少妇| 亚洲啪av永久无码精品放毛片 | 波兰性xxxxx极品hd| 裸体武打性艳史| 国产乱淫av麻豆国产免费| 日本一区二区三区网站| av黄色在线免费观看| 美女被艹视频网站| 无码人妻精品一区二区三区温州| 成人国产精品久久久网站| 国产高清视频免费在线观看| 久久久久亚洲av无码网站| 日本少妇高潮喷水xxxxxxx| 国产精品情侣呻吟对白视频| 熟妇无码乱子成人精品| 亚洲区免费视频| 蜜桃色一区二区三区| 久久亚洲无码视频| 95视频在线观看| 亚洲女人毛茸茸高潮| 捆绑裸体绳奴bdsm亚洲| 911国产在线| 欧洲女同同性吃奶| 岛国大片在线免费观看| 日本乱子伦xxxx| 国产chinese中国hdxxxx| 娇小11一12╳yⅹ╳毛片| 手机av免费看| 欧美做受高潮中文字幕| 日韩精品久久久久久久的张开腿让| 欧美图片自拍偷拍| 538任你躁在线精品视频网站| 亚洲黄色小说视频| 无码任你躁久久久久久老妇| 韩国三级丰满少妇高潮| 国产一级淫片久久久片a级| 日本xxxx裸体xxxx| 欧美xxxxx精品| 182在线视频| 午夜不卡久久精品无码免费| 免费黄色av网址| 九九热最新地址| www.av成人| 麻豆传媒在线看| av天堂一区二区| 野战少妇38p| 国产三级视频网站| 亚洲成人av免费在线观看| 国产性生活毛片| 色呦呦一区二区| 18禁裸乳无遮挡啪啪无码免费| 中文字幕日韩三级片| 丰满大乳奶做爰ⅹxx视频| 国产肥白大熟妇bbbb视频| 亚洲v国产v欧美v久久久久久|