Context-free grammars

If Context-free grammars can symbolize every regular expression, then why do one requires R.E at all?

E

Expert

Verified

The reasons are as follows:

a) Regular Expression are Simpler than the Context-free grammars.

b) This is simpler to construct a recognizer for R.E than the Context-Free grammar.

c) Breaking the Syntactic structure to Lexical and non-Lexical parts give better front end for the Parser.

d) R.E is most powerful in explaining the lexical constructs such as identifiers, keywords and so on while Context-free grammars in symbolizing the nested or block structures of the Language.

   Related Questions in Computer Engineering

©TutorsGlobe All rights reserved 2022-2023.