Compute the first and follow sets for each non-terminal

Assignment Help Computer Engineering
Reference no: EM133259634

Question 1: Regular Expressions

Write down regular expressions in JFlex syntax for each of the following string patterns:

a. Real numbers written to at most 2 decimal places (NB: zero d.p. means the number is an integer). So, 10, 1.5, 2.25 are all allowed, but 1.875, 0.0001 are not. For simplicity, you should require that there is at least 1 digit before any decimal point in the string.

b. Strings of upper case letters in which each of the vowels (A, E, I, O, U) may appear at most once, and if it does, it must appear only after any vowels that alphabetically precede it. The vowels do not necessarily have to appear consecutively within the string. Examples of permissible strings are "BAKER", "LACKING", "BENIGN", "ASCENSION", "ALVIOLUS"; examples of forbidden strings are "INSTEAD, "ALARMING", "AVOID"

Question 2: Parsing [50] In the following CFG, the symbols {a, b, c, d, e, $} are terminals. All others are non-terminals. X → Y Z Y → Y d|cY |e Z → aZb|XY

a. Draw the LR(0) state diagram for the CFG

b. Determine the first and follow sets for each non-terminal in the CFG.

c. Giving reasons for your answer, determine whether the CFG is:

(i) LR(0)

(ii) SLR(1)

d. The CFG is clearly not LL(1) because it is left-recursive.

(i) Rewrite the CFG to obtain an equivalent CFG that is no longer left-recursive (also ensure that your new CFG is fully left-factored).

(ii) Compute the first and follow sets for each non-terminal of your new CFG.

(iii) Construct the LL(1) parser table for your new CFG.

(iv) Determine from your table, whether the new CFG is LL(1) or not (give reasons for your answer).

Reference no: EM133259634

Questions Cloud

Calculate monthly payment and total payment : Assume you have a balance of $3200 on your credit card that you want to pay off. Calculate your monthly payment and total payment under the given conditions.
Algorithm for computing a heaviest lis : The goal is find an increasing subsequence such that its sum is maximized. Give a O(n) algorithm for computing a heaviest LIS
Analyse the e-shop system : describe the service experience of an individual, to assess the impact upon well-being using relevant concepts, and to identify potential improvements or applic
What is the law of conservation of energy : Explain in detail the 3 laws of thermodynamics with examples. What is the law of conservation of energy and how is this relevant to our lives
Compute the first and follow sets for each non-terminal : Compute the first and follow sets for each non-terminal of your new CFG and Rewrite the CFG to obtain an equivalent CFG that is no longer left-recursive
Marketing strategies in emerging markets : Which of the following is NOT one of the five A's key for successful marketing strategies in emerging markets?
What is the expected quantity sold at optimal price : 1. Assume that demand for a product is linear with the equation Q = 260x(1-P/13), where Q denotes quantity and P denotes price in dollars.
Provide a real life example of a multichannel conflict : Q1. Provide a real life example of a multichannel conflict. Why is it a conflict? (The example should not be from the textbook).
What are the main issues that the article addresses : What are the main issues that the article addresses? How is this issue related to information systems and digital privacy

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd