Parsing Explained - Computerphile

preview_player
Показать описание
How ambiguity is dangerous! Professor Brailsford simplifies parsing.

This video was filmed and edited by Sean Riley.

Рекомендации по теме
Комментарии
Автор

Hi everyone, I mentioned in the video that multiply over the positive integers was commutative but as some of you have pointed out, the more precise issue -- in terms of ambiguity side-effects from differing parses -- lies in the associative properties of multiply and divide . Thus, most languages will interpret 8 * 4 * 2 as being (8 *4) * 2 (i.e. left associative) but, in the case of *, the right associative version: 8 * (4 * 2) gives the same answer . This is not so for the / operation where left and right associative versions give different answers. In the absence of any parentheses, as in 8 / 4 / 2, the compiler's job is to enforce the default of: (8 /4) / 2, i.e. left associativity, to get the correct result. I'm hoping to explain, at some stage, how compilers can do this .

profdaveb
Автор

"the robot stroked two furry dice"
--Professor Brailsford 2019

gregfletcher
Автор

Every time I watch one of these videos I thank the man that put these great men in front of a camera and made it available to anyone for free.
Grateful of being able to meet them and learn so much

parek
Автор

First time I see a video from this guy and I liked it very much. He reminds me of those few teachers at college that explained very complex issues in ways that are easy to understand.

granadosvm
Автор

After watching this, calling "programming language" a "language" makes waaay more sense than before.

Gornius
Автор

I was a second year undergraduate in 1973 studying biology when I first met BNF. I had to take a 6 lesson course in Algol 60 and the lecturer started off with BNF before immersing us in the language. At the time I wrote BNF off as something I had to get through to complete the module. It was only later I discovered how very useful it is for analysing and learning programming languages (a lot of us back then ended up in computing for paid work, Biology graduates were ten for a penny) I’m even using it now to help me learn Hungarian. So thanks, Prof, for this walk down memory lane.

StephenFarthing
Автор

Big thumbs up! I spent months explaining to the language designers of a 3rd generation language in ICL in 1979 that their proposed syntax had loops / ambiguities! We used an automated tool called SAG (Syntax Analyser Generator) that generates a pseudo code for a little FSM to perform the parsing. It also allowed you to call ‘action routines’ to put the syntactic elements on a binary tree on the go.

Richardincancale
Автор

The issue is not commutativity, it is associativity

fuuryuuSKK
Автор

Today I got an A from our (allegedly notoriously hard) algorithms exam. I've picked RPN and syntactical analysis. It was trough these types of videos from Prof. dfb that I've learned so much and sometimes much more then there was in our materials. Oftentimes these videos explain the concepts in a better and more concise manner than any lecture would. Thank your, professor, for what you have done for me and surely many more people trough these videos.

subnumeric
Автор

Parsing in the computer science is lexical analysis and grammar analysis. Such approach simplify the job. Lexical analysis is usually regular grammar done by finite automata with checking one symbol ahead to determine the next step it's input are characters and output lexeme structures. Grammar analysis often works on context free grammar and usually checking one symbol ahead to determine next step it's input are lexeme structures and output is often tree of parsed structures of the language.

radoslawjocz
Автор

This was excellent, very clear informative and interesting. I'd love to see more on this topic. Especially anything to do with the difference between Parse Trees and Abstract Syntax Trees, what they are, and what use they serve. Also, anything on the Shunting Yard Algorithm and its relation to top-down parsing would be great. Thanks!

MrAdamkimbo
Автор

Always a good day when there is a new Prof Brailsford video on Computerphile! <3's

chaoslab
Автор

Man, I love your videos, you remind me one (only one) of my teachers - his classes were so cool - like your presentations. Thank you

zyghom
Автор

i keep thinking the seinfeld theme is going to play every time an item is popped off the stack

DigaDupSuck
Автор

Thank you so much for the concise explanation! I'm taking advanced programming languages and data structures as courses right now and I hate the way they introduce parse trees. I spent over an hour reading and re-reading my required reading on parse trees and just couldn't understand it. I got more out of this video in 15 minutes than I did sitting with my thumb up an ungodly location parsing through the text.

samuelmontypython
Автор

Couldnt have come at a perfect time, watching whil(st)e writing one for a compiler as I watch.

andurilan
Автор

That part at 12:47 was so subtle. The hilarious part is that he is so used to Binary that it is easier for him to think in terms of "32 twos" instead of "Two 32s".
Also, "The robot stroked the fuzzy dice". Love it.

azrobbins
Автор

Among many other things I used to write data editors, that is tools that checked the validity of inputs. I used a grammar building tool with EBNF notation. It had a learning curve but I caught on. That grammar building tool taught me that defining a grammar is quite a job.

isabellabihy
Автор

I'm a simple man, I see Professor Brailsford, I click.

bredbert
Автор

Came for the parsing; stayed for the tractor paper... (ok and clear and interesting teaching that made me smile as my brain hurt a bit from getting filled)

potatoradio