Question

Please explain the lexical analysis of the following grammar: b* a b* a (a+b)* For example,...

Please explain the lexical analysis of the following grammar: b* a b* a (a+b)*

For example, this can generate the word: bbabbbabbaa since the first b* can be used to generate two b's followed, then an 'a', followed by three b's in the second b* followed by an 'a', then (a+b)* can be used to generated a 'b', 'b', 'a', and an 'a'.

Please explain in simple terms as this topic is confusing. What more can be said about the grammar?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Actually  b* a b* a (a+b)* is not a grammar but a regular expression

Let me break it down

b* can generate zero or more b's

a can generate only a single a

b* can generate zero or more b's

a can generate only a single a

(a+b)* can generate any combination of a's and b's including (empty string)

The shortest string that it can generate is

a a

In short, the expression generates strings that contain atleast two a's.

You can never generate strings that contain less than two a's.

Add a comment
Know the answer?
Add Answer to:
Please explain the lexical analysis of the following grammar: b* a b* a (a+b)* For example,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Please Do it In Java: Objectives: To Java programming language To understand the lexical analysis phase...

    Please Do it In Java: Objectives: To Java programming language To understand the lexical analysis phase of program compilation Assignment: The first phase of compilation is called scanning or lexical analysis. This phase interprets the input program as a sequence of characters and produces a sequence of tokens, which will be used by the parser. Write a Java, program that implements a simple scanner for a source file given as a command-line argument. The format of the tokens is described...

  • Please explain how to do part (b), (c) and (d) only The PID control architecture might be popular, but that does not mean it can be used for everything. This question explores when the PID controller...

    Please explain how to do part (b), (c) and (d) only The PID control architecture might be popular, but that does not mean it can be used for everything. This question explores when the PID controller is (in)sufficient: when it is too much, when it is "goldilocks", and when it is not enough. Consider a plant given by P'(s)-SaAs n increases, so does the order of the system. (sta)" Let's consider three orders and how PID controller design works for...

  • 7. Lexical analyzer, is the first phase in compiler, Of what use is this to the...

    7. Lexical analyzer, is the first phase in compiler, Of what use is this to the whole compilation and 14 marks) what are the formal concepts involved ? 8. Describe this language using a Regular Expression: all strings beginning with a digit, followed 13 marks] by either a or b, and ending with an non-vowel uppercase letter 9. Write a context free granimar for the strings that consist of equal number of a's followed by equal number of b's. Attempt...

  • Why are some reactions irreversible (for example: HCl reacting with Mg)? Please explain in the terms...

    Why are some reactions irreversible (for example: HCl reacting with Mg)? Please explain in the terms of energy profile diagrams (since this is used in the explanation of reversibility of reactions) and any other knowledge.

  • Cost Behavior Major Concept Assmt #1 Explain and give a unique example the following concepts of...

    Cost Behavior Major Concept Assmt #1 Explain and give a unique example the following concepts of cost behaviors: • Cost drivers Fixed cost and Variable Costs • CVP Analysis Write in complete sentences and pay close attention to grammar Please make sure to clearly explain the concepts as if you were teaching and explaining to another student, that has no background on these concepts. Also, make sure to use a unique example. Take this example from your own situation, either...

  • Full working and explanations for the steps required would be greatly appreciated. Thank-you very much! Will rate! Q2. P...

    Full working and explanations for the steps required would be greatly appreciated. Thank-you very much! Will rate! Q2. PID: Possibly Insufficient Design 120 points] The PID control architecture might be popular, but that does not mean it can be used for everything. This question explores when the PID controller is (in)sufficient: when it is too much, when it is "goldilocks", and when it is not enough. Consider a plant given by P (s) . As n increases, so does the...

  • The first project involves modifying the attached lexical analyzer and the compilation listing ge...

    The first project involves modifying the attached lexical analyzer and the compilation listing generator code. You need to make the following modifications to the lexical analyzer, scanner.l: 1. A second type of comment should be added that begins with // and ends with the end of line. As with the existing comment, no token should be returned. 2. The definition for the identifiers should be modified so that underscores can be included, however, consecutive underscores, leading and trailing underscores should...

  • Cost Behavior Major Concept Assmt #1 Explain and give a unique example the following concepts of...

    Cost Behavior Major Concept Assmt #1 Explain and give a unique example the following concepts of cost behaviors: • Cost drivers • Fixed cost and Variable Costs • CVP Analysis Write in complete sentences and pay close attention to grammar Please make sure to clearly explain the concepts as if you were teaching and explaining to another student, that has no background on these concepts. Also, make sure to use a unique example. Take this example from your own situation,...

  • Problem 1. This problem is intended to reinforce your understanding of the nodal analysis and node-...

    Problem 1. This problem is intended to reinforce your understanding of the nodal analysis and node- branch equation formulation techniques. Consider the following simple circuit. a. Apply nodal analysis to generate a linear system of equations which can be used to compute the circuit node voltages. Where appropriate, please give matrix or vector entries as analytical formulas in terms of R1, R2, R3 and Is. b. Use the node-branch approach to form a linear system of equations which can be...

  • AS YOU PLAN OUT YOUR ANALYSIS PROJECT, ANSWER ONE OF THE FOLLOWING QUESTIONS: 1.What type of samp...

    AS YOU PLAN OUT YOUR ANALYSIS PROJECT, ANSWER ONE OF THE FOLLOWING QUESTIONS: 1.What type of sampling do you plan to use? If you're not sure, what type would you like to use, if possible, and why? 2.What types of statistics will you use to describe your sample? What variables will you use? For example, you will provide the mean and standard deviation for age, frequency distribution by gender and disability status. 3.Did you find anything confusing about probability? If...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT