Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 Problem Specification In this assignment, you complete an incomplete syntax analyzer designed for verifying the syntax of a given code written in mini -

1 Problem Specification In this assignment, you complete an incomplete syntax analyzer designed for verifying the syntax of a given code written in mini-Java, a simplified version of Java programming language. The lexical analyzer of mini-Java is completely implemented in Python. You can find the implementation in lexer.py file. You do not need to add any code to this file. The goal of this assignment is to complete the implementation of a top-down recursive- decent parser for mini-Java. The incomplete implementation of parser is available in parser.py file. 2 EBNF Grammar for mini-Java The parser of mini-Java is implemented based on the following EBNF Grammar. As mentioned in class, in a EBNFgrammar, variables (not-terminals) are enclosed by angle-brackets<>, optional part of a rules right-hand-side isenclosed in brackets [], and repetitive part of a rules right-hand-side is enclosed in curly braces {}. Each repetitive part may be repeated zero time, once, twice, three times, etc. (1)->[package ID;]{import ID{.ID}[.*]; }(2)->[public]class ID[extends ID][implements ID{,ID}]LB RB (3)->{[public|protected|private][static]ID({,ID}; |)}(4)-> LB {} RB (5)->(ID|boolean|byte|char|short|int|long|float|double){LBR RBR}| void (6)-> LP [ID{,ID }]RP (7)-> ID[=]{,ID[=]}; |||||(7)->[(break | continue | return []|| ID{.ID}LP[{,}]RP)]; (8)-> ID{.ID}(=|+=|=|/=|=)|{(+|)}(9)->{(|/)}(10)-> NC|CC|SC|BC|NL| ID{.ID}[LP[{,}]RP]| LP RP (11)-> for LP [[]ID=]; ;[ID=|ID++|ID] RP

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database And Transact SQL

Authors: Lucy Scott

1st Edition

1974679985, 978-1974679980

More Books

Students also viewed these Databases questions

Question

List the advantages and disadvantages of the pay programs. page 505

Answered: 1 week ago