Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!