Ask Question
10 April, 05:01

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. 10 April, 08:40
    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?
Get 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 there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers