Backus-Naur Form
HTML-код
- Опубликовано: 10 сен 2024
- BNF, or Backus-Naur form is an elegant and succinct way of expressing a grammar in very few lines. Find out more about how this works in today's random Wednesday tutorial!
Content from Wikipedia was displayed in this video, and is accessible at the following URL: en.wikipedia.or...
The content is licensed CC-BY-SA-3.0
Full Text: creativecommon...
= 0612 TV =
0612 TV, a sub-project of NERDfirst.net, is an educational RUclips channel. Started in 2008, we have now covered a wide range of topics, from areas such as Programming, Algorithms and Computing Theories, Computer Graphics, Photography, and Specialized Guides for using software such as FFMPEG, Deshaker, GIMP and more!
Enjoy your stay, and don't hesitate to drop me a comment or a personal message to my inbox =) If you like my work, don't forget to subscribe!
Like what you see? Buy me a coffee → www.nerdfirst.n...
0612 TV Official Writeup: nerdfirst.net/0...
More about me: about.me/lcc0612
Official Twitter: / 0612tv
= NERDfirst =
NERDfirst is a project allowing me to go above and beyond RUclips videos into areas like app and game development. It will also contain the official 0612 TV blog and other resources.
Watch this space, and keep your eyes peeled on this channel for more updates! nerdfirst.net/
-----
Disclaimer: Please note that any information is provided on this channel in good faith, but I cannot guarantee 100% accuracy / correctness on all content. Contributors to this channel are not to be held responsible for any possible outcomes from your use of the information.
9 years later and this vid is still helping students out (at least it helped me tremendously thank you!) 🙏
Hello and thank you very much for your comment! Great to hear you found the video useful =)
Oh yess!
Fuckyeaaaaah
This i need in my playlist ! because:
::= |
Hahaha, good application!
Thank you for your comment =)
Evne though this video is already 2 years old I wanted to say thank you. Wel explained.
+Cro nay Thank you very much for your comment! Glad to be of help =)
+lcc0612 Very nice job man! You described it extremely well! Thank you :)
+designbulk You're welcome! Glad you liked the video =)
Now it's almost 3.
and I sill thank him.
You're welcome =) Always good to hear my work has been useful!
You made it sound so easy and comprehensible. Clarity on fundamental ideas is the crux of this video. Great job!.
Hello, and thank you so much for your comment. I'm really happy you found this video helpful!
You explained it well and as someone said in the comments below that your hand movements do not make this video boring at all. Thank you for doing this video.
+Pranav Sharma Hello and thank you very much for your comment! Glad the hand movements weren't too distracting =)
i like all your hand gestures, they keep me focused ! thanks for this awesome video
Thank you very much! Glad you found the video useful =)
Here in 2022 and the channel, the content and the edit is a whole mood
Hello and thank you very much for your comment! Glad you liked the video =)
Great enthusiasm and well explained.
Hello and thank you very much for your comment! Glad to be of help =)
10 years later and this vid is still helping students out
Hello and thank you very much for your comment! Always happy to be of help :)
you just helped me a lot. Even this video is 7 years old. thanks!
You're welcome! Very happy to be of help =)
Thank you for the simple explanation, even someone like me was able to understand with ease!
You're welcome! Very happy to be of help =)
You really made it easy to understand. You did it! Thx!!!
I know this is really old now, but still super helpful for Computer Science students 4 years later!
Hello and thank you very much for your comment! That's great to hear :) All the best for your journey in CS!
On behalf of my computing class. You explained the backus naur form very well in your video. thx m8 i r8 8/8
+TheEnslayer Cheers! Glad to be of help to you and your class =)
I have a report for tomorrow. I think this video will help me to explain it well. Thank you
You're welcome! All the best for your report =)
This is so awesome and so concise. Watching this video before a quiz. Thanks so much. Please keep making these!
Hello and thank you very much for your comment! Very happy to be of help, hope you do well for your quiz =)
Day before my test, bro you are telling it with so much joy and that helps me a lot. Thanks for the great video
Hello and thank you very much for your comment! Really happy you liked the video =) All the best for your test!
Thanks for this! Trying to understand these concepts with a text book is quite difficult.
mintlou You're welcome! Very happy to be of help =) And I agree, it's not always easy to self-learn some things in computer science!
Thanks, friend you made it very easy to understand looking foward to more videos.
You're welcome! Very happy to be of help =)
Do have a test in 2 days and you helped me big time! Thanks soo much!
You're welcome! Very happy to be of help =)
Thank you for your comment, and all the best for your test =)
Thanks for this smart and short introduction to BNF
You're welcome! Glad to be of help =)
Thank you! The lectures provided by my uni are so lazy and have so many gaps that I almost gave up on learning about lexers, but your video helped me a lot!
Hello and thank you very much for your comment! Glad to be of help :)
Thanks a lot for making things easy to understand.
You're welcome! Very happy to be of help =)
This really helped me grasp the concept. Thanks from 2021!
You're welcome! Very happy to be of help =)
still watching this in 2017.great job man thanks a hexa times
You're welcome! Happy to be of help =)
Fantastic job explaining BNF and giving some examples. Thank you very much.
You're welcome! Very happy to be of help =)
Wow you are such a good explainer ! So simple and yet SO understandable ! Thank you very much
You're welcome! Very happy to be of help =)
I really love your explanation sir.
Hello and thank you for your comment! Glad you liked the video =)
A huge thank you. You just saved me
You're welcome! Very happy to be of help =)
Thank you! I needed to know this for my computer science class during quarentine cuz teacher is being useless
You're welcome! Very happy to be of help =)
You're fantastic at explaining things, cheers
Hello and thank you very much for your comment! Glad you found the video useful =)
great video and amazing explanation !!
Hello and thank you very much for your comment! Glad you liked the video :)
LOL I love how this video is explained and your hand movements are cool. They brake boringness of the theoretical part.
Thanks anyway
+Menuka Ishan Thank you very much for your comment! Glad you liked the video =)
Thankyou so much, the way my teacher explained it made it seem so complicated but youve cleared everything up:D
Michael Savaglia You're welcome! Very happy to be of help =)
Great video. Thanks for sharing.
You're welcome! Very happy to be of help =)
Thanks for making this video, it's really helped me out with my hw assignment :).
You're welcome! Glad to be of help :)
Great explanation, saved me a lot of time!
Hello and thank you for your comment! Happy to be of help =)
Thanks for the video! Now I have to find this way to implement this into the project.
Ohai, glad you found your way here =P
Thanks for your comment! Good luck with the implementation =D
I learned something. Thanks!
Hello Unclewich, and thank you so much for your comment!
Glad you found this video helpful. There certainly is a novelty factor to it which I felt would be interesting =D
Ayyy thanks , I managed to understand BNF the day b4 my examination thru your video, yey xD
Hello and thank you for your comment! Hope the exam went well :)
omg ricky from trailer park boys has that same shirt. you are my hero.
Hahahaha that's interesting. I had that shirt for years, no idea it's a design that gets on TV =P
Excellent explanation, is it possible to define nested parentheses using BNF grammar ?
::= 'A'|'B'|'C'|...
::= |
:= '(' | ')'
Will this check for nested parentheses?
Piyush Jain Try
::= 'A'|'B'|'C'|...
::= |
::= '(' ')' | | |
Thank you, big thanks
You're welcome! Glad to be of help :)
Thanks for the explaining it so clearly!
You're welcome! Very happy to be of help =)
great explanation !
Hello and thank you very much for your comment! Glad you liked the video =)
Thank you for your explanation!
You're welcome! Glad to be of help :)
Bossed the explanation! Thanks!!
Outrageous You're welcome! Glad you liked the video =)
Very well explained, many tanks!
You're welcome! Very happy to be of help :)
Nice! Thanks for the explanation!
You're welcome! Glad to be of help =)
Thank you! This video helped me a lot!
You're welcome! Very happy to be of help =)
Thanks man for the video
You're welcome! Happy to be of help =)
Impressive presentation!
Leo Carlsson Thank you very much for your comment! Glad you liked the video =)
Cool, Thank you very much. It is really helpful.
+郑成功 You're welcome! Glad to be of help :)
Very clear explanation. thank you
You're welcome! Glad to be of help =)
Great explanation. Thank you so much :)
You're welcome! I'm very happy to be of help, and I'm glad you found the video useful. Thank you very much for your comment =)
One word brilliant. Please make more videos :)
Hello and thank you very much for your comment! More videos come twice a week =)
watching the as a quick refresh for BNF and seriously the recursive call made me spit my water out that was funny
Heh, glad you liked it!
Nice video! Next time make some exercises too please
Hello and thank you for your comment! This is something I've considered before, but unfortunately it's not easy to find the time to set and discuss exercise questions and answers!
Maybe in the future, if this stuff finally pays the bills, I can consider doing it!
WE WANT MORE!!!
Christ 10 years ago... wow
Hello and thank you very much for your comment! Yeah this is from a loooong time ago, but at least I'm still here, lurking in the comments.
Any specific topics you're interested in? I'll see what I can do.
This is good, but please practical examples, like writing names of people, thanks
Hello and thank you for your comment! Good idea, might want to revisit this topic in the future.
Thank you for this! Very helpful!
Jacob Vasu You're welcome! Very happy to be of help =)
hmm so the space in between is the lettuce. I understood, thanks! I will ace my test.
Hello and thank you for your comment! Hope the test went well =)
@@NERDfirst thanks, my test will be on April 19th. It will be in Japanese but I like things explained in English by people like you better cuz it's easier to understand. thanks!
well done! Thumbs up
Mohamed Jehad Baeth Thank you! Glad you liked the video =)
This helped so much! thanks!
Sam Hoey You're welcome! Very happy to be of help =)
Hi, can you explain how to write a BNF parser to check syntax in java??
Hello and thank you for your comment!
There is waaay too much to talk about for that! I recommend you look up some external libraries for this purpose. Perhaps try BNF for Java: bnf-for-java.sourceforge.net
you are awesome man
Thank you! Glad you liked the video =)
high quality stuff. thanks!
You're welcome! Glad to be of help =)
Nice explanation, thanks bruh!
You're welcome! Glad to be of help =)
awesome dude. awesome
siksreik Thank you very much! Glad you liked the video =)
thank you man
You're welcome! Happy to be of help :)
In what kind of programs or context is this format used?
Heya RevenTr! Thanks for your comment =)
More often than not, BNF is used on paper. Its primary purpose is to communicate how the grammar is set up in a command-based program.
That's not to say there aren't programs out there that will perform BNF parsing, of course. Since BNF is so general, any program can actually incorporate it, and use it as a tool to drive command-based input.
Thanks!
You're welcome! Happy to be of help =)
Helpful!
Thank you! Glad to be of help =)
thank you :)
You're welcome! Glad to be of help :)
Keep going bro
Thanks a lot ^^
You're welcome! Happy to be of help =)
Thanks for the explanation :) However technically, are these equivalent?
1. ::= |
2. ::= |
Hello and thank you for your comment! While both the definitions you have specified would "work correctly" (ie. You can construct words out of letters, or build bigger words by "attaching" letters to words), if you "traced" them by following the logic, they would behave a little differently.
If I had a sequence of letters ["H","E","L","L","O"], definition (1) would assemble the word "HELLO", since each subsequent letter is appended to the existing word.
However, definition (2) would give us "OLLEH", because each incoming letter is added _before_ the existing word.
I don't see this as being a major concern, since the order of input is generally beyond the scope of BNF. However, to make it easier to intuitively understand, I would prefer definition (1), since we could simply "trace" it to see how it works.
Very detailed explanations. Again, thank you! :)
You're welcome! Glad to be of help :)
Awsome!!!!
Thank you very much for your comment! Glad you enjoyed the video =)
Thanks man
You're welcome! Very happy to be of help =) Thank you for your comment!
Dude you rock
Thank you very much! Glad you found the video helpful =)
Very nice! ;)
Thank you very much! Glad you liked the video =)
Thank you so much!
You're welcome! Very happy to be of help =)
Worked wonder brother. Hope to talk to you more about PC stuff.
Hello and thank you for your comment! Glad you liked the video! If there's more you'd like to discuss, feel free to leave a comment anytime or shoot me a message!
i like your passion.. but i do have a suggestion.. you mention ' " ' [double quotes] instead of " ' " [single quote] as not being part of BNF.. Kindly make that correction.. Great passion. keep it up.
+Shankar Nair Hello and thank you for your comment! Could you give me a timestamp where I made that statement? The closest thing I found is at 1:55, but that refers to when I used "..." onscreen. The statement was in reference to the ellipsis, not the quotes.
+lcc0612 Hi, Look at the time stamp around 2 minutes where you say you have put double quotes for convenience but you are showing single quotes for the letters..
+Shankar Nair Hello again. As I have mentioned in my previous post, what I have added for convenience is this: ...
Not double quotes.
wow/ Just wow.
Still helpful in 2022
Hello and thank you for your comment! Glad you found the video helpful. The good thing is, this stuff doesn't exactly go out of date, so I'm hopeful it'll remain relevant decades down the line.
Hello, im doing an intro comp sci course, i have to make a grammar for us telephone numbers then modify it so that only certain numbers will be used in certain portions. the beginning part was easy i think
::=
::=
>area code> ::=
::= 0|1|2|3|4|5|6|7|8|9
So I could be entirely wrong, it seems like I have alot of non terminals called but to me that much makes sense,
however if i wanna modify the grammar to say that the 2nd digit of area code has to be a 0 or a 1, or say the first digit of the has to be a 4 or a 5
is there a way to do this?? Im lost
Hello and thank you for your comment! You are able to mix literal values with references to rules, so if you want to say that the 2nd digit of the area code can only be 0 or 1, you can say:
::= "0" | "1"
why the hell didnt i think of that?
I was thinking somethign like this
::=
::= 0|1
::= 0|1|2|3|4|5|6|7|8|9
seems much more complicated now
I hate to be a further bother but im a begginner and kinf of lost, Im trying to figure out the following Grammar but am stuck
::= |
::= | >next>
::= A
I thought at first this was an example of recursion< but im so god ^%#$ frustrated at this right now i cant think straight, ive been trying to draw a parse tree with an input string of arbitrary A's but cant get it
do you have any siuggestions or maybe resources i could look at?
Your method using is actually the best way to go if the restrictions are more complicated. It's a good train of thought so keep that in mind, it's just that the current situation happened to fit for a simpler solution.
If you want to be able to work with a string of arbitrary As, then very basic recursion is enough!
::= "A"
::= |
That means a word can be "built" by starting from a letter, and attaching more letters at the end. Let me know if this isn't clear, I'll throw together a very quick video to demonstrate this.
Thanks so much for entertaining what must be "ridiculous" questions for you.
I do see clearly now, what you mean about teh basic recursion I guess what Im getting at is how to tell what a grammar is describing:
::= |
::= ,
::= A
To me this grammar is describing an input string on either A or AA, so if I were to use an input string of more than two A's, Im thinking my compiler would give me an error?
However, I have another grammar that is slightly different:
::= |
::= , |
::= A
I was thinking that this grammar described an arbitrary number of As, but if I draw a parse tree for something like this, and im sure im doing somethign wrong
It's been a while since ive been in school, again, I appologize
A A A A A
\ /
\ /
?
No worries =) This is actually quite fun so I don't mind at all!
Let's try and figure out what you have written:
::= |
::= , (Is the comma on this line intentional? I'm going to assume it is. Either way, it helps us be clearer so I'll keep it in)
::= A
With the rules, we can either work forwards (construct) or backwards to see if things fit the rules.
Working backwards: "A" is a valid , since a goal is a letter and "A" is a letter.
Working forwards (construction): A goal can also be a letter appended to (from ::= ). We start by building the first letter which is "A". must be a comma followed by a letter, and the only letter we have is A, so the only other valid goal is "A, A".
You are right to say nothing else is possible. Since we don't use recursion and don't have a case for three-letter long goals (or longer ones), nothing else is valid.
***
For your second part, you can in fact have strings of arbitrary length, thanks to the rules for . The second half reads:
::=
That means I can build a object by sticking a letter to its front, and it still remains a next object so I can repeat this as many times as I like.
Now, I have to admit that a parse tree isn't something I'm familiar with, and in fact I question how useful it is in this context because the definition is recursive in nature and it's not something that's easy (or good!) to represent using a tree, but let's try it anyway for the string "AAA". Here's what I got: drive.google.com/file/d/0B2Ia5aQpQ8CnclpfMjBmVnhEOEU/view?usp=sharing
This video was super helpful! Is there any chance we can get one on extended BNF?
Hello and thank you very much for your comment! Glad to be of help =)
I haven't actually heard of extended BNF before today! I'll put this idea on the list, look it through, and see where it gets me.
Good video
+Abdullahi Ibrahim Thank you very much! Glad you liked the video =)
Thanks
You're welcome! Glad to be of help =)
Cant i just do
Phrase ::= | ‘ ‚
?
Hello and thank you for your comment! If you did it this way, you can't have a phrase longer than two words!
For example: "Hello there" is a phrase because it is . However, "How are you" is not a phrase because the definition of a phrase does not allow .
That's why we simply say ::= |
This means that, if we have a phrase, adding a word to the back of it still makes it a phrase. I can have a 1 word phrase or a 100 word phrase, they're all covered by the definition.
0612 TV w/ NERDfirst damn, Thank you
how to read this
Example E ::= E + T | T
T ::= T * F | F
F ::= id | constant | (E)
where E is Expression, T is Term, and F is Factor
Hello and thank you for your comment! I think what makes this confusing is that firstly, it's quite messily written (which can be corrected for), and a few elements are either undefined or not clearly defined (not quite as easy to correct). Let me first rewrite it in something that looks closer to BNF for clarity:
::= '+' |
::= '*' |
::= | | "(" ")"
The following terms are unclear: "+", "*", "(", ")". Are these literals? I assume they are.
The following terms are probably expression, in which case you have to supply their definitions: , .
Do more videos
Hello and thank you for your comment! Next video is being edited right now! Don't worry, the new videos will come. For now, don't forget to check out the rest of the catalog!
Thank you for your clear and comprehensive explanation. The given examples are also very good. Maybe less gestures would be better, it could be distracting :) .
Ricky Chandra Hello and thank you very much for your comment! Glad you liked the video! I've been told about the gestures, and I'm working on them (to a certain extent! They help me think =P).
great job
Hello, and thank you very much for your comment! Glad you liked the video =)
it's my duty :)
Gosh 8 years ago
Hello and thank you for your comment! Luckily the concepts haven't changed =)
@@NERDfirst Thank you for the video!
I saw what you did there with recursive :D
Hello and thank you for your comment! Not really sure what I did there =P Care to explain?
@@NERDfirst 3:27 what recursive means? well, it means recursive :D
Oh! I forgot I did that heh. That was one of my favorite nerd jokes at the time =P
@@NERDfirst I like it tho :D
Heh glad you liked it =)
hahah awesome intro
Really fucking good.
Rederick Deathwill Cheers! Happy to be of help =)
Fantastic explanation, thank you! The only thing which annoyed me was your hands dancing around all over the place.
Hello and thank you for your comment! I've heard! The movements help me think, but I'm working on cutting them down =)