I'm starting an online Computer Science class called Advanced Programming Languages, and the book asks me to create a parse tree and generate a grammar from it. Here are the exact instructions:
To verify that a string of characters belongs to a language defined by a grammar, we must create a parse tree that shows that the string can be generated by the grammar.
<list> -> <item> , <list> | <item> <item> -> <left> <item> <right> | <left> <right> <left> -> A| B | C <right> -> x | y | z
Choose a string that is in this language and create a parse tree that demonstrates that your claim is true. Identify another string that contains some of these terminals symbols but is not in the language.
I think I know how to get started, but I keep getting confused by examples in the book and examples online. Is there a general method to use when approaching this?
I began it this way:
<list> / \ <item> <list> / | \ <left> <item> <right> | / A <left>
But I get confused on the next iterations of the
item. Any hints?