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
b. For unsuccessful parsing: The Sentence
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started