Given the following grammar: -> | -> -> | -> | -> a| b | c -> 1 | 2 | 3 Indicate
ID: 3584421 • Letter: G
Question
Given the following grammar: -> | -> -> | -> | -> a| b | c -> 1 | 2 | 3 Indicate which of the following strings are valid according to this grammar. For those that are valid, construct the parse tree. a1b2c3 (valid) abc123(valid) 12ab 11aa22 ab12c3(valid) In English, describe the strings generated by this grammar as specifically as possible. I already have the valid strings and the trees for each one of them. I just need help describing them in English. Thanks for your help.Explanation / Answer
Its quite simple .. See, taking -> | as the start symbol , if we look carefully, whatever string we generate from the grammar it will always have an alphabet from a|b|c at its left owing to the grammar rules : -> -> | -> a| b | c and the numerical symbols at the right owing to the grammar rules :: -> -> | -> 1 | 2 | 3 Thus whatever String starts with an alphabet and ends with an numerical symbol is Valid and hence 1 , 2 and 5 are valid Hope it helps ... Since I'm posting the answer first .. plz rate me first so that I can get the Karma points .. thanks :)Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.