Question: Ruby case statement is similar to the switch statement in Java. It has the following syntax: case expression when expression 1 then code . .
Ruby case statement is similar to the switch statement in Java. It has the following syntax:
case expression when expression then code
when expression then code
whe n expression then code else code end Describe the syntax in BNF I started it with casestmt case expr when whenclause then stmt and then Im not sure where to go from here, if this even how to start itIm not adding the angled brackets because it doens't show the words inside of it for some reason Also I undestand how to do the parse tree and derivation when I have the BNF rules already, I was just never really taught how to actually describe the syntax in BNF so any help would be amazing. Also here's the code I'll be using to ch eck make the tree and derivation from the rule:
grade C
case grade
when A
then puts "Amazing!!"
when B
then puts "Good Job!"
when C
then puts Cs get degrees!"
else
puts "Put a little more effort in and ask for help!"
end
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
