Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

1a-f) Multiple Choice: Select the best answer and write it on the blank. Also provide the specification for the language.

Which specification technique would be the weakest(least powerful; we talked about the layers of specification power)that is capable of describe this language?

a)  strings of  three or more g's 

A.  regular expression    C.  pseudorational grammar

B.  context free grammar             D.  language expression

b)  expressions consisting only of single digits separated by +  such as      

A.  regular expression    C.  pseudorational grammar

B.  context free grammar             D.  language expression

c)  lists of digits such as

A.  regular expression    C.  pseudorational grammar

B.  context free grammar             D.  language expression

d)  ambn  : strings with m a's followed by n b's  , m, n ≥ 1

A.  regular expression    C.  pseudorational grammar

B.  context free grammar             D.  language expression

e)  anbn  : strings with some number of a's followed by same number of b's  , n ≥ 1

A.  regular expression    C.  pseudorational grammar

B.  context free grammar             D.  language expression

f)  strings of 1's of an even length, containing only 1's

A.  regular expression    C.  pseudorational grammar

B.  context free grammar             D.  language expression

g)  binary strings containing an even number of 1's ( at least one 1 )

A.  regular expression    C.  pseudorational grammar

B.  context free grammar             D.  language expression

2a-l) True or False: Write a T or F in the blank

___ a) Automata is just another name for a graph

___ b) YACC is a tool that is used to build a parser

___ c) It is called a 'finite' state automata because it will only work for finite languages

___ d) The only way to represent an automata is the nodes/edges graphical diagram

___ e) Regular grammar just means that the grammar is correctly written

___ f) A context free grammar is also a regular grammar

___ g) A regular grammar is also a context free grammar

___h) BNF rules are used as the production rules in a context free grammar

___ i) Regular Expression (a | b)(c | d) generates a finite language

___j) RE's (a | b)(c | d) and (c | d)(a | b) denote different languages {set of words}

___ k) RE's (a | b)(c | d) and (b | a)(c | d) denote different languages

___ l) RG's can be used to replace any context free grammar

3) Draw an automaton that recognizes precisely the following language: strings, from the alphabet {a, b}, which contain a substring with at least 2 consecutive b's.

4) Consider the language over alphabet {a, b} that contains all strings that have a length of at least 2 and also start and end with the same letter - for example ( abaa ).  Provide the following for this language (a) Regular Expression  (b) DFA (c) Context Free Grammar [ give the CFG some thought to not make it twice as long as necessary ]

5) For each string, indicate if it will be accepted by the DFA.

2042_Figure.png

String

Yes

No

0 1 0 1

 

 

0 1 0 1 0

 

 

0 1 1 1 1

 

 

0 0 1 0 1

 

 

 

 

 

6) Indicate with Yes or No: Is the word in the language defined by the specification rules? Circle Y or N   for each word and each language. (or delete the wrong answer )

Word

Is In

A àAa
A
à b

 

Word

Is In

( a | b )*

ab

Y      N

 

ab

Y      N

aab

Y      N

 

aab

Y      N

baa

Y      N

 

baa

Y      N

Word

Is In

A àAA
A
à ab

 

Word

Is In

(ab)*

ab

Y      N

 

ab

Y      N

aab

Y      N

 

aab

Y      N

baa

Y      N

 

baa

Y      N

Word

Is In

A àa B
B
àb | x | a

 

Word

Is In

a*b*

ab

Y      N

 

ab

Y      N

aab

Y      N

 

aab

Y      N

baa

Y      N

 

baa

Y      N

7a-b) Consider a language of all nonempty sequences of @ symbols.

a) Write a regular expression for this language

b) Write a context free grammar for this language

8) Draw a parse tree for aaa as produced by grammars G3 and then G4.

Grammar : G3

 

Grammar : G4

S = a S

S = a

 

S = S a

S = a

9 a-b) Consider our standard Expression grammar as a guide for correctly formed expressions.

1) E = E + T

2) E = T

3) T = T * F

4) T = F

5) F = (E)

6) F = num

a) Draw a Parse Tree for the expression for     2 + (5 + 3) * 7

b) Draw an Abstract Syntax Tree for the same expression

c) Show the infix, prefix, and postfix representation for the expression from (a)

10) Lex & YACC implementation. Below include Lex & YACC specification as well as sample output. You can just paste the text of the Lex/YACC/Output rather than screen shots Format it, make it readable. Also indicate the location in account for the code. Sample output to right (15 pts)

Problem: read in a list of numbers; report back the sum & count

  • space separated list of positive integers
  • may be more than 1 digit in a number

1826_Figure1.png


Attachment:- Assignment.rar

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92227001
  • Price:- $65

Guranteed 36 Hours Delivery, In Price:- $65

Have any Question?


Related Questions in Computer Engineering

Question a as we have seen the internet layer of tcpip has

Question : (a) As we have seen, the Internet layer of TCP/IP has two protocols - IPv4 and IPv6. The transport layer provides two main protocols TCP and UDP (along with some special-purpose, minor protocols). But these ar ...

What pieces of hardware and software do the collision

What pieces of hardware and software do the collision detection?

Once considered pure science fiction artificial

Once considered pure science fiction, artificial intelligence (AI) is being relied on more and more in today's world. Artificial intelligence deals with algorithms based on complex data sets. If you had to tell story rep ...

Help me define corporate social responsibilityhelp me

Help me define corporate social responsibility. Help me conduct research on a Fortune 500 company and how do you determine just how (or if) the company ranks from a CSR perspective. Help me understand if the findings cha ...

Suppose you are given the following consumption and income

Suppose you are given the following consumption and income data: Consumption   100   190  280  370  460  550 Income                 0   100  200  300  400  500 Obtain an equation for the consumption function. Use your fu ...

Scenario 1 19500 ascii characters are transmitted over a 3

Scenario 1: 19,500 ASCII characters are transmitted over a 3 Mbps circuit. The protocol uses 8-bits to encode each ASCII character, and adds an additional parity bit to help detect errors. Calculate the transmission effi ...

We live in kapurkua a small island in the mediterranean

We live in Kapurkua, a small island in the mediterranean between Greece and Spain (no, it doesn't really exist so don't look it up in the map). In the island we produce and consume canoes, latreks (a garment that is comf ...

With respect to tm4c123 arm cortex m4 processorhow many

With respect to TM4C123 ARM Cortex M4 Processor How many machine cycles are required to process first line of ISR after an interrupt occurs? What are the other benefits of NVIC to process interrupt more efficiently?

It has been a bad day for the stock market and you have

It has been a bad day for the stock market and you have heard that only 30% of all stocks gained value. Suppose you have a portfolio of 10 securities and assume a binomial distribution for the number of your stocks that ...

Question recall that many programming languages use short

Question : Recall that many programming languages use short circuit evaluation when determining the result of a complex boolean expression involving add/or operations. What are the benefit of using short circuit evaluati ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As