Ask Question
16 December, 14:46

In chapter 3, we discussed syntax and semantics, in general there are two types of grammars for programming languages, regular and context-free, what is the difference, what is the scope (where are they applied), and how can the use of these grammars produce a higher level of program reliability. Does this higher level of reliability encourage complexity?

+5
Answers (1)
  1. 16 December, 17:49
    0
    Lexical rules that are defined in case of regular grammar are simple and the notation is quite easy to understand.

    Regular expression are useful for defining constructs of identifiers or constants. e. g. a|b etc.

    In the case of context-free, grammar is not simple and deals with the productions.

    Context-free are useful in describing the nested constructs like if-else etc which are not defined by regular expressions.

    These produce a higher level of reliability as it provides a medium for generating syntactical as well as semantic data. The grammar is context-free is a little complex.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “In chapter 3, we discussed syntax and semantics, in general there are two types of grammars for programming languages, regular and ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers