Ask Question
Yesterday, 23:44

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?

+3
Answers (1)
  1. Yesterday, 23:48
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers