Question: Submit a pdf for problems 1 4 and a Haskell * . hs file for problem 5 . 1 . Using the grammar below, show
Submit a pdf for problems and a Haskell hs file for problem
Using the grammar below, show a parse tree and a leftmost derivation for the sentence
B AC B
A B C
Rewrite the following BNF to add the postfix and unary operators of Java.
A B C
Show that the following grammar is ambiguous. Note: The terminals symbols are in bold.
&&
OR
True False
x y z
CS Homework Syntax
Submit a pdf for problems and a Haskell hs file for problem
Write a grammar G for the language L consisiting of strings of s and s that are the binary
representation of odd integers greater that For example LLLL
Draw parse trees for the strings and
Below is the EBNF grammar for the animal sentence language
and
and
catsdogsbearsgoats
chasecuddlehugscare
sadsmallbighappy
Note: the nonterminals are in and the terminals are in
Using the Sentence.hs template provided.
a Define the abstract syntax for the animal language as a Haskell data type.
b Provide pretty printing functions for the sentences in the language.
c Provide functions to build a sentence.
d Write a function isMean to determine if a sentence only contains the verbs chase and
scare.
e Write a function to build a sentence that is a conjunction of other sentences.
f Write a function wordCount that computes the number of words in a sentence
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
