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 expression1 then code ...
when expression2 then code ...
whe n expression3 then code ...... else code end Describe the syntax in BNF. I started it with case_stmt -> case expr when when_clause then stmt and then I'm not sure where to go from here, if this even how to start it.*I'm 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 "C's 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 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!