I am trying to learn how to build parse trees.
I have watched videos and tried to do some on my own, but am a little lost.
In this example, I am given the following:
$$ \begin{align*} &S\to(L) \\ &S\to a \\ &L\to L,S \\ &L\to S \end{align*} $$
and then I am told to draw a parse tree for the expression $(a,(a,a))$.
I know that the first $S$ is the start symbol, I know that since I am trying to draw it for a specific string, I should use the bottom up approach, but I am very confused.
Can the lines above also be written as $$ \begin{align*} &S\to(L)|a \\ &L\to L,S|S \end{align*} $$ or can they not be combined that way?
How would you write this tree? What confuses me the most is how to write the tree using the $L$ and $L,S$ but resulting in $(a,(a,a))$.
I would appreciate any explanation or demonstration offered.
