Computer Science Fundamentals Algorithms Subjective
Feb 25, 2013

Why do we use regular expressions to define the lexical syntax of a language?

Detailed Explanation
  • The lexical rules of a language are frequently quite simple, and to describe them we do not need a notation as powerful as grammars.
  • Regular expressions generally provide a more concise and easier to understand notation for tokens than grammars.
  • More efficient lexical analyzers can be constructed automatically from regular expressions than from arbitrary grammars.
  • Separating the syntactic structure of a language into lexical and non lexical parts provides a convenient way of modularizing the front end of a compiler into two manageable-sized components.

 

Discussion (0)

No comments yet. Be the first to share your thoughts!

Share Your Thoughts
Feedback