What is a Parse Tree? + Example

preview_player
Показать описание
Here we introduce parse trees, which are a visual representation of context-free grammars, specifically in their derivations. We give an example of a parse tree, namely for balanced parentheses. Additionally, we give reasoning as to why (leftmost) derivations are equivalent to parse trees, and that we can then without loss of generality talk about parse trees as a result.

(This is a re-record of a video with the same general material, uploaded in 2020.)

Timeline:
0:00 - Intro
0:24 - Context-Free Grammar for Balanced Parentheses
1:00 - Example Derivation of a String
5:00 - Creating the Parse Tree
10:15 - How to read a string in a Parse Tree?
12:00 - What purpose does a Parse Tree have?

▶ABOUT ME◀
I am a professor of Computer Science, and am passionate about CS theory. I have taught many courses at several different universities, including several sections of undergraduate and graduate theory-level classes.
Рекомендации по теме
Комментарии
Автор

Thanks to Micah Wood (Platinum), and Josh Hibschman, Timmy Gy, Patrik Keinonen, and Travis Schnider (Silver) for helping support this video. If you want to contribute, links are in the video description.

EasyTheory
Автор

Man, I wish you were my professor. I didn't understand a single thing about parse trees until now.

Caiahar
Автор

Very well done video, helped me a lot, appreciate it

trobosko
Автор

hello from BR. Great video! Easy to understand.

carlosiagobueno
Автор

Oh interesting, this video clarifies that the entry symbol S is inherently from the producible strings. Otherwise is there some assumption that S can only be symbols that terminate within the rule set? Perhaps I'm running in circles, I'm not clear on what you may do if S was actually not () [or some combination of '(' and ')'], or is this impossible [example, S != (()]? Maybe I missed in an earlier video something along the lines of 'CFG is producing a string from the Language, from symbols recognized in this language'?

jacobh
Автор

Please provide an example on how to show if a given grammar is ambigious or not

_zerox_X
Автор

I really want to know why the tree grow down in the first place

manhxxo
Автор

Why did you start with SS variables first and not (S) for example?

CLG