In formal language theory, a context-free grammar (CFG) is a formal grammar whose production rules are of the form with a single nonterminal symbol, and a string of terminals and/or nonterminals ( can be empty). A formal grammar is "context-free" if its production rules can be applied regardless of the context of a nonterminal. No matter which symbols surround it, the single nonterminal on the left hand side can always be replaced by the right hand side. This is what distinguishes it from a context-sensitive grammar. A formal grammar is essentially a set of production rules that describe all possible strings in a given formal language. Production rules are simple replacements. For example, the first rule in the picture, replaces with . There can be multiple replacement rules for a given nonterminal symbol. The language generated by a grammar is the set of all strings of terminal symbols that can be derived, by repeated rule applications, from some particular nonterminal symbol ("start symbol").Nonterminal symbols are used during the derivation process, but do not appear in its final result string. Languages generated by context-free grammars are known as context-free languages (CFL). Different context-free grammars can generate the same context-free language. It is important to distinguish the properties of the language (intrinsic properties) from the properties of a particular grammar (extrinsic properties). The question (do two given context-free grammars generate the same language?) is undecidable. Context-free grammars arise in linguistics where they are used to describe the structure of sentences and words in a natural language, and they were invented by the linguist Noam Chomsky for this purpose. By contrast, in computer science, as the use of recursively-defined concepts increased, they were used more and more. In an early application, grammars are used to describe the structure of programming languages. In a newer application, they are used in an essential part of the Extensible Markup Language (XML) called the Document Type Definition. In linguistics, some authors use the term phrase structure grammar to refer to context-free grammars, whereby phrase-structure grammars are distinct from dependency grammars. In computer science, a popular notation for context-free grammars is Backus–Naur form, or BNF. (Wikipedia).
7.1: Intro to Session 7: Context-Free Grammar - Programming with Text
This video introduces Session 7: Context-Free Grammar from the ITP course "Programming from A to Z". A Context-Free Grammar is a set of recursive "replacement" rules to generate text. In this session, I discuss two JavaScript libraries: Tracery and RiTa.js for working with context-free gr
From playlist Programming with Text - All Videos
How a Computer know a Sentence is Grammatical: Context Free Grammars [Lecture]
This is a single lecture from a course. If you you like the material and want more context (e.g., the lectures that came before), check out the whole course: https://boydgraber.org/teaching/CMSC_723/ (Including homeworks and reading.) Music: https://soundcloud.com/alvin-grissom-ii/review
From playlist Computational Linguistics I
Building context-free grammars: Theory of Computation (Mar 12 2021)
Context free grammars! This is a recording of a live class for Math 3342, Theory of Computation, an undergraduate course for math & computer science majors at Fairfield University, Spring 2021. Class website: http://cstaecker.fairfield.edu/~cstaecker/courses/2021s3342/
From playlist Math 3342 (Theory of Computation) Spring 2021
Compilation – Why learn about compilers?
As you will see when you watch this series, compilation involves a diverse range of themes in the field of computer science including high and low level programming paradigms, the definition of context free grammars, the application of dynamic data structures such as stacks, linked lists,
From playlist Compilation
Theory of Computation 5. Context Free Languages ADUni
From playlist [Shai Simonson]Theory of Computation
Javascript Context Tutorial - What makes Javascript Weird...and Awesome Pt5
View whole series here: https://www.youtube.com/playlist?list=PLoYCgNOIyGABI011EYc-avPOsk1YsMUe_ Call, Apply & Bind are avoided by many JS developers, but it doesn't have to be that way. Context is a simple concept that creates complicated realities for developers. In this javascript tu
From playlist Javascript Tutorial For Beginners
Context-free closure properties: Theory of Computation (Mar 24 2021)
This is a recording of a live class for Math 3342, Theory of Computation, an undergraduate course for math & computer science majors at Fairfield University, Spring 2021. Class website: http://cstaecker.fairfield.edu/~cstaecker/courses/2021s3342/
From playlist Math 3342 (Theory of Computation) Spring 2021
Theory of Computation: Closure properties for CFL
This video is for my Spring 2020 section of MA 342, for the class meeting on Wednesday March 25. Visit the class website for homework as usual! Fast forward music is from "Now Get Busy" by the Beastie Boys, licensed Creative Commons Noncommercial Sampling Plus.
From playlist Math 342 (Theory of Computation) Spring 2020
More grammars: Theory of Computation (Mar 10 2021)
More grammars! This is a recording of a live class for Math 3342, Theory of Computation, an undergraduate course for math & computer science majors at Fairfield University, Spring 2021. Class website: http://cstaecker.fairfield.edu/~cstaecker/courses/2021s3342/
From playlist Math 3342 (Theory of Computation) Spring 2021
Computation Ep25, Stacks and CFGs (Apr 5, 2022)
This is a recording of a live class for Math 3342, Theory of Computation, an undergraduate course for math and computer science majors at Fairfield University, Spring 2022. The course is about finite automata, Turing machines, and related topics. Homework and handouts at the class websi
From playlist Math 3342 (Theory of Computation) Spring 2022
Computation Ep20, Context Free Grammars (Mar 11, 2022)
This is a recording of a live class for Math 3342, Theory of Computation, an undergraduate course for math and computer science majors at Fairfield University, Spring 2022. The course is about finite automata, Turing machines, and related topics. Homework and handouts at the class websi
From playlist Math 3342 (Theory of Computation) Spring 2022
Theory of Computation 9. More lemmas, CYK ADUni
From playlist [Shai Simonson]Theory of Computation
4. Pushdown Automata, Conversion of CFG to PDA and Reverse Conversion
MIT 18.404J Theory of Computation, Fall 2020 Instructor: Michael Sipser View the complete course: https://ocw.mit.edu/18-404JF20 YouTube Playlist: https://www.youtube.com/playlist?list=PLUl4u3cNGP60_JNv2MmK3wkOt9syvfQWY Quickly reviewed last lecture. Defined context free grammars (CFGs) a
From playlist MIT 18.404J Theory of Computation, Fall 2020
Live Stream #65: Session 7 - Programming from A to Z
This Live Stream covers Context-Free Grammars (Session 7 of the "Programming from A to Z" class at ITP http://shiffman.net/a2z/). I discuss grammars in general and get into the specifics of context-free grammars. I demonstrate two different JavaScript libraries: RiTa.js and Tracery, as w
From playlist Live Stream Archive
Theory of Computation 10. Undecidability and CFLs ADUni
From playlist [Shai Simonson]Theory of Computation