Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

THE CHALLENGE Consider the following variation of the BNF you worked with for Hands-on 6: I :- +1 -11/ : albl... Iz First, let's be

image text in transcribed
image text in transcribed
THE CHALLENGE Consider the following variation of the BNF you worked with for Hands-on 6: I :- +1 -11/ : albl... Iz First, let's be sure everyone is perfectly clear on the interpretation of the (identifier) rule. This rule tells us an identifier consists of any single lower-case alphabet letter What about the (expression) rulo? The first alternative says, an expression can be an identifier (that is, is a SINGLE LETTER. So one possibility for an expression is a SINGLE LOWERCASE LETTER. For example, a or xor w. . The second alternative says, on expression con be 2 expressions joined by an operator (that is, cop>). Those two expressions can be either of the 2 alternatives, howevert So a+b or c*wa and so on. NOTE parentheses ARE NOT allowed in this languagell Like the Week 6 grammar, the unique characteristic of this grammar is that every "lexeme" (significant part of the language consists of a single character. So you might come up with a categorization scheme like the following: LEXEME TOKEN any single lowercase letter ID_TOKEN -or-oror / OP TOKEN a16.12 ID_TOKEN ANYTHING ELSE ILLEGAL TOKEN THE CHALLENGE Write a recognizer for this grammar in the "recursive descent" style. That is your solution should include a scanner function (that finds lexemes and tokesn), as well as a collection of boolean functions. a parser or recognizer that understands the various parts of the grammar and knows how they should be put together if the input is a valid "sentence in the language. We'll walk through a "recursive descent plan" in class if you need some design inspiration Your program should accept an input string S, then output its determination, that is, either s is a valid sentence in this grammar - OR - S is not a valid sentence in this grammar where is the input string. Use the following test cases: m a+(b-c) z/w + X/Y -b CAZ d+/ THE EVIDENCE You must submit Code - File save, or copy paste into Notepad from your IDE or editor. I must be able to open or copy/paste the code from your submission to desk- check" and run it myself . Runs of your program showing it correctly handled all the test cases. Acceptable "evidence could be file saves from your IDE or Os of choice, or screen shots. Please merge your test case evidence into a single file

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_2

Step: 3

blur-text-image_step3

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

More Books

Students also viewed these Databases questions

Question

Increasing investment time and money in employee training.

Answered: 1 week ago

Question

What are Electrophoresis?

Answered: 1 week ago