HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Practical Applications of regular grammars

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
applicationsregulargrammarspractical

Problem

A regular grammar is a mathematical object, $G$, with four components, $G = (N, Σ, P, S)$, where. $N$ is a nonempty, finite set of nonterminal symbols, $Σ$ is a finite set of terminal symbols , or alphabet, symbols, $P$ is a set of grammar rules, each of one having one of the forms. $A → aB$.

I want to know what's Practical Application of these grammars. I mean where and how do we use these in real world?

Also it may be helpful if someone tells me about the weaknesses of regular grammars.

Thanks in advance.

Solution

Regular grammars are more-or-less the same as NFAs, so you might as well ask what applications these have. Finite automata are used in compilers, for performing lexical analysis. Any course on compilation will contain ample information on this.

As for the weaknesses of regular grammars, they only describe regular languages. In particular, they're not enough to parse programming languages, even superficially. We use context-free grammars for that. Any course on formal languages and automata will explain all of that very clearly.

Context

StackExchange Computer Science Q#57141, answer score: 4

Revisions (0)

No revisions yet.