Consider a language defined over E={ab} that accepts the strings starting with a. a. Give its transition diagram using JElap. b. Write a C/C++ program that stays in an infinite loop, prompts the user for a string, terminates if the string is QUIT, and otherwise implements the DFA using the scheme that allows state to state function-call and recursion. c. Give the source code and the runtime screen while testing the strings aabab. abbaaba and abbb.
Q: 1. For each of the following regular expressions find a language (i.e., a set of strings) over A =…
A: a)a*bc+bc* Language is {bc,, abc,aabc,,aaabc,.......a,ac,acc,accc,,........} this regular expression…
Q: Question Consider a language defined over E={a,b} that accepts the strings starting with a. a. Give…
A: Actually, program is an executable software that runs on a computer.
Q: Make an experiment with the ML language system that demonstrates that ML doesn't recopy lists when…
A: ML: Machine learning (ML) may be a kind of computer science (AI) that enables computer code…
Q: State and explain the convention followed for writing a recursivedescent parsing subprogram.
A: Parsing are process of tracing or construction of a parse tree for a given string input…
Q: (a) Show the internal representation (box-pointer diagram) of the LISP list as obtained below: > ( l…
A:
Q: Write a C program to demonstrate the use of extern.
A: Hey there, I am writing the required solution based on the above given question. Please do find the…
Q: For each of the below snippets, mark suitable positions for breaks for the crossover operator.…
A: ONLY THREE SUBPARTS ARE SOLVED. RESEND THE QUESTIONS ON THE PORTAL FOR THE SOLUTION.
Q: Q2 \ write program in C# language to read employee information (Name, Salary, Graduation, Age) and…
A: Note: As per the policy we can answer a question at a time. Please repost the other question to get…
Q: In its ADT system, Java has three access modifiers for instance variables while C# has five.…
A: Every Object oriented language has concept like 'abstraction'. abstraction is a way to hide the real…
Q: Please explain why "side-effects" are not allowed in pure functional programming languages. What…
A: Given: Functional programming includes a variety of approaches, all of which are acceptable and have…
Q: Make a flowchart with steps/explanations on the side for C Language. The topic is about Numerical…
A: Answer: I have given answered in the handwritten format in brief explanation
Q: What is escape analysis? Describe why it might be useful in a language with a reference model of…
A: The escape analysis is used to analyze the scope of the used pointer in the programming.
Q: Let the language over {a, b, c, d, e, f} accepting all strings so that: 1. There are precisely two…
A: The answer for the above question is as follows
Q: Write a program in C and give screenshot of output - non-preemptive scheduling - Round Robing…
A: Programming approach:- Using the necessary header file. Using the main function. Initialize the…
Q: Prove that the following language is not context-free:
A: To Prove: {01 102 103 1 . . . 0n-1 10n 1| n >= 1}, is not context-free.
Q: 2. Give a CFG that generates the language L = {b'db° |i > 0} U{dd}. Also, demonstrate that your CFG…
A:
Q: 2- Write CFG for the following languages a) L= {a"b?n, n20} b) L= {a?^b^, n20} c) L= {ww*}, w={a,b}"…
A: Step 1 The solution is given in the below step
Q: Write a Scheme program to reverse a web link graph so that for each web site considered, we know…
A: Please see the code below. As no language is mentioned, I've done it in Python. However, idea will…
Q: -Draw the internal representation for the following lisp list(s). - (cons '( ((apple () orange ()) (…
A: _______cons '( (() apple orange (grape) banana)) '().
Q: Given the alphabet as {0, 1}, write a DFA for the following three regular languages. (Give the…
A: Hey, since there are multiple questions posted, we will answer the first question. If you want any…
Q: Recall this little grammar again: A→BX y|ɛ
A: I'm not making LL(1) parsing table rather I've used a short trick to find out whether the grammar is…
Q: Represent the reversed web link graph in a similar way. For example, [a, b, c] means that {b, c} is…
A: Please see the code in step 2. As no language is mentioned, I've done it in Python. However, idea…
Q: Consider the following piece of code of a language that uses dynamic scoping: PrA(){ int k, m, n;…
A: We need to provide the referencing environment.
Q: The finite state machine (FSM): a b A В generates the regular language, L = {a"b™ | a 2 1 and m 2…
A: Below is your desired function plus all the code needed to test it.
Q: Consider a language defined over E={a,b} that a. Give its transition diagram using JFlap 1. Vuie…
A: Program Explanation:- Using the header file. Otherwise, transition to a state. Display enter the…
Q: For a lexically scoped language with nested subprocedures, the chain offset for the use of a…
A: The difference between the static depth of the subprogram containing the reference to a variable and…
Q: Given the parent language L={w∈{a,b,c}}*, what is the language the following regular expression…
A: Given, L={w∈{a,b,c}}* Regular Expression = /([a-c]*a[a-c]*b[a-c]*)|([a-c]*b[a-c]*a[a-c]*)/
Q: Given a CFG G and a variable A, consider the problem of testing whether A is usable. We say A is…
A: The language of the decision problem isAεCFG = { hGi | G is a CFG that generates ε }.If a CFG G =…
Q: 2- Write CFG for the following languages c) L= {ww}, w={a,b}* d) L= {anb2n, n>0} U {ww}, w={a,b}*
A: A 4-tuple G = <V, S, P> is a non-contextual grammar (CFG) if V and the complete sets do not…
Q: The following is a grammar for JH-Lisp 2.1, modified version of the language you encountered in…
A: In formal language theory, the grammatical grammar, G, is said to be in Chomsky's common sense when…
Q: Write a regular expression that describes the languages of automata from picture 1 and picture 2…
A: We need to write the regular expression for the given automata design. The regular expression for…
Q: Make a list of the differences between dynamic programming and divide-and-conquer.
A: Dynamic programming The dynamic programming divides the main problems into smaller sub-problems and…
Q: L = {w | w contains the string 001 as a substring} Describe the extended transition function on a…
A: (a) Transition Table: 0 1 q0 q1 q1 q1 q0 q0 State Diagram: (b)…
Q: Write a Scheme program to reverse a web link graph so that for each web site considered, we know…
A: the program is given below:-
Q: Write Regular Expression for the language having strings ax, bx, cx, aax, bbx, ccx, aaax, bbbx, cccx
A: Provided the regular expression for the above given language as shown in the below attached…
Q: Write a regular expression that describes the languages of automata from Homework No. 2 and Homework…
A: Regular Expression has 8 Steps are as follows: Step 1- Eliminate q1q0: abq2: ba*q0 to q2: b+aaq2 to…
Q: Construct a CFG and PDA for the language B={w| w is a string over {a,b} with the same count of a's…
A: PDA
Q: 1. For each of the following regular expressions find a language (i.e., a set of strings over A =…
A: 1. Defined a languages for the given regular expressions
Q: Define a language consisting expression like X" represents of the eight legal octal digits with the…
A: The correct answer for the above question is given in the following steps.
Q: {w|w=a*b'c*, k =i+j, i,j,k> 0} (E= {a,b,c})
A: For the language aibjck where i+j=k Let S be the start variable Let context-free grammar be denoted…
Q: Question 14 Bonus problem. Consider the following program fragment, written in a language with…
A: Please give positive ratings for my efforts. Thanks. ANSWER a) Deep Binding: 20 30 11 Deep…
Q: Write a C-program to read marks in the Programming and Data Structure Laboratory (out of 100) for N…
A: Introduction of the program: The C program takes the marks of the students from the user and then…
Q: In general, there are two types of grammars for programming languages, regular and context-free,…
A: The lexical rules in the case of regular grammar are simple and the notations are quite easy to…
SUBJECT: FINITE AUTOMATA THEORY AND FORMAL LANGAUGE
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 4 images
- A palindrome is a string that reads the same forwards or backwards; for example dad, mom, deed are palindromes (i.e., reversing a palindrome produces the same string). Use C++ Programing language Write a recursive, boolean-valued function, isPalindrome that takes a string as a parameter and returns whether the string is a palindrome. A string, s, is a palindrome if: s is the empty string or s consists of a single letter (which reads the same back or forward), or the first and last characters of s are the same, and the rest of the string (i.e., the second through next-to-last characters) form a palindrome. Write a test program that reads a string from the standard input device and outputs whether the input string is a palindrome or not.3. A palindrome is a sentence that contains the same sequence of letters read-ing it either forwards or backwards. A classic example is "Able was I, ere I saw Elba." Write a recursive function that detects whether a string is a palindrome. The basic idea is to check that the first and last letters of the string are the same letter; if they are, then the entire string is a palindrome if everything between those letters is a palindrome. There are a couple of special cases to check for. If either the first or last character of the string is not a letter, you can check to see if the rest of the string is a palindrome with that character removed. Also, when you compare letters, make sure that you do it in a case-insensitive way. Use your function in a program that prompts a user for a phrase and then tells whether or not it is a palindrome. Here's another classic for testing: "A man, a plan, a canal, Panama!"There are many features in C++ programs that must be ``balanced'' to be syntacticallycorrect. For example, every ( must be balanced by a corresponding ). Similarly for {}and []. There are other (somewhat more complex) situations.• Block comments must be balanced. Each /* must be balanced by a */ Thecomplication here is that the tokens being balanced are not composed of singlecharacters. Moreover, the ``closing comment'' */ starts with a character that isused in other ways (pointers, multiplication).• Quotes must be balanced. This applies to single quotes and double quotes. Thecomplication here is that all the material between the matching quotes cancontain any characters. The characters between the quotes do not requirebalancing. For example, the string "This is a /* ' * quote" is legal, and thecomment and single-quote need not be balanced.• Inline comments are not balanced. Anything that comes after a comment isignored until you get to the end of the line that's read in. You must…
- Write the simplest C++ program that will demonstrate iteration vs recursion using the following guidelines - Please include pre/post and pseudocode for the 3 functions which are not 'main' in the solution. Write two primary helper functions - one iterative (IsArrayPrimeIter) and one recursive (IsArrayPrimeRecur) - each of which Take an array and its size as input params and return a bool such that 'true' ==> array and all elements are prime, 'false' ==> at least one element in array is not prime, so array is not prime. Print out a message "Entering <function_name>" as the first statement of each function. Perform the code to test whether every element of the array is a Prime number. Print out a message "Leaving <function_name>" as the last statement before returning from the function. Remember - there will be nested loops for the iterative function and there can be no loops at all in the recursive function. For the recursive function - define one other helper…Please use easy logic with proper indentations and comments for understanding!. Coding should be in C++. 2. Write a recursive function that reads words from the standard input stream and displays them in reverse order on the standard output stream. For example, if the input was: here comes the sun, the output would be: sun the comes here. Hint: Read individual words until the end of a sentence is reached. You can determine the end of the sentence any way you like. Some suggestions include (a) checking the last character of a word for a sentence terminator (. ? ! ) (b) Using a keyword such as 'quit' to indicate the end of input. (c) Using the eof method of the cin object. (ctrl Z for windows or ctrl D for others can be used to force an end of file from the keyboard.)Please use easy logic with proper indentations and comments for understanding!. Coding should be in C++. 1. Write a recursive function named printStars which receives an int parameter. If the parameter is positive, the function prints the given number of asterisks; otherwise the function does nothing. The function does not return a value. Thus, if the printStars(8) is called, ******** (8 asterisks) will be printed. The function must not use a loop of any kind to accomplish its job. Instead, it gets the job done by (recursively) calling itself.
- Write a c++ code. Write a recursive function, vowelsCount that returns the number of vowels in a string. Output must needed.Create a function in C++ using recursion where the user inputs a number. The function will repeat an equation where you get the square root of a number for the amount of loops selected. A random number between 1-10 will be used to determine the length of the loop.(C Language) Write a recursive function called PrintNumPattern() to output the following number pattern. Given a positive integer as input (Ex: 12), subtract another positive integer (Ex: 3) continually until a negative value is reached, and then continually add the second integer until the first integer is again reached. For this lab, do not end output with a newline.
- In c++ please with clear indentation thank you so much Write the simplest program that will demonstrate iteration vs recursion using the following guidelines - Write two primary helper functions - one iterative (IsArrayPrimeIter) and one recursive (IsArrayPrimeRecur) - each of which Takes an array of integers and its size as input params and returns a bool such that 'true' ==> all elements of the array are prime, so the array is prime, 'false' ==> at least one element in array is not prime, so array is not prime. Print out a message "Entering <function_name>" as the first executed statement of each function. Perform the code to test whether every element of the array is a Prime number. Print out a message "Leaving <function_name>" as the last executed statement before returning from the function. Remember - there will be nested loops for the iterative function and there can be no loops at all in the recursive function. For the recursive function - define one…This section is divided into two subsections. Each subsection contains a problem to be solved using both recursive and non-recursive approaches. You need to implement the solution in one of your preferred languages ( C++, or JAVA). In addition, you need to provide the order growth analysis and plot the input size vs. run-time graph for both approaches. The n th Triangle Problem Write a code for finding the n th triangle number of triangle sequences: 1, 3, 6, 10, ..., n. That is, your code should accept an integer number, which indicates the triangle levels, and returns how many dots we need to form a triangle with respect to the given level. For example, consider the Fig 1. For n = 3 (can be also written as T3), your code should returns 6. Provide a single program consists of the following: • Write a function called TriangularRecursive for the recursive version that takes number of level as an int argument. Hints: 1) Identify the base case for the TriangularRecursive function. 2) Let…Recursive Exponentiation (using c language) Write a recursive function power(base, exponent) that when invoked returns baseexponent. For example, power(3, 4) = 3 * 3 * 3 * 3. Assume that exponent is an integer greater than or equal to 1. Then, write a demo program that uses the power function and test it out for a number of inputs. Hint: The recursion step would use the relationship baseexponent = base * baseexponent–1 and the terminating condition occurs when exponent is equal to 1 because base1 = base