Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You have your choice of programming languages for this assignment: Scheme OR F# (or OCaml) Write a program (in one of the languages listed above)

You have your choice of programming languages for this assignment:

Scheme OR F# (or OCaml)

Write a program (in one of the languages listed above) which:

1. Accepts:

a. A space-delimited set of symbols representing a sentence to be represented as a parse tree. (The user should simply be prompted for the input to be entered via keyboard)

2. Outputs:

a. For successful parsing: The Sentence follows the grammar.

b. For unsuccessful parsing: The Sentence is incorrect because:

BNF for parser MOSTLY the Same as for Program I.

sentence : np vp np sentence_tail;

sentence_tail : conj sentence | eos;

np : art adj_list noun pp;

adj_list : adj adj_tail | ? ;

adj_tail : comma adj_list | ? ;

pp : prep np | ? ;

vp : adv verb | verb;

// *** terminals ***

comma : ',';

eos : '.' | '!';

adj : 'fast' | 'slow' | 'furry' | 'yellow' ;

adv : 'quickly' | 'slowly' | 'quietly';

art : 'a' | 'the';

conj : 'and' | 'or';

noun : 'dog' | 'cat' | 'mouse' | 'tree' | 'cheese' ;

prep : 'of' | 'around';

verb : 'likes' | 'hates' | 'eats' | 'chases';

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

Microsoft SQL Server 2012 Unleashed

Authors: Ray Rankins, Paul Bertucci

1st Edition

0133408507, 9780133408508

More Books

Students also viewed these Databases questions