Define a context free grammar. What are the applications of context free languages?


Context free grammar (CFG): A contest free grammar is a finite set of variables each of which represents a language. A context free grammar (CFG) is denoted
G = (V, T, P, S)
Where,
V = a finite set of variables
T = a finite set of terminals
P = a finite sets of production or rules that represent the recursive definition
Of a language. Each production consists of: 

  • A variable that is being defined by the production. 
  • The production symbol. 
  • A string of zero or more terminals and variables. 

So that it is of the form A → α, where A is a variable and α is a string of symbols from (V ∪T).
S = is a special variable called the start symbol
Of a language. Each production consists of: 

  • A variable that is being defined by the production. 
  • The production symbol. 
  • A string of zero or more terminals and variables. 

So that it is of the form A → α, where A is a variable and α is a string of symbols from (V∪T).
The applications of context free languages: 
(i) In an early application, grammars are used to describe the structure of programming languages.
(ii) In a newer application, they are used in an essential part of the Extensible Markup Language (XML) called the Document.
(iii) In most programming languages opening and closing of braces, a curly bracket is taken care. It mainly tracks it and if any closing bracket is not there, it will throw error.

No comments

Dear Members, Thanks for Your Comments. We must be reply your comment answer as soon as possible. Please Stay with us.....

Theme images by ideabug. Powered by Blogger.