Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I want to know question number 4. I would be grateful if you could help me with the details. I am really confused about this
I want to know question number 4.
I would be grateful if you could help me with the details. I am really confused about this assignment. And please don't copy other answers to here.
2. Consider the following grammar, which specifies a language of simple expressions referring to a person or group of people. The symbol name is a terminal that matches any person's name. The other lowercase symbols (and, friend, and 's) are terminals that match as written. Demonstrate whether this grammar is ambiguous. EEandE|FFEsfriendIname 3. In a single complete, clearly written English sentence, describe the language defined by the following regular expression. ( a(ab)b)(bbaa) 4. Make a regular expression for the following languages. a. All number strings that have the value 42 . b. All number-strings that do not have the value 42 . c. All number-strings that have a value greater than 42 . 5. Give an LL(1) grammar for the following language: All strings with i a's followed by i+1bc, where i>=0. For example, bc, abcbc, and aabcbcbc are all in this language. (5) Prove that your grammar is LL(1). 6. Prepare the following grammar for top-down parsing. Remove left recursion and perform left factoring. SAbAAbCABd e BACbbd 7. List 5 of the tokens found in the following C code: float limitedSquare (x) float x f /* returns x squared, but never more than 100/ return (x=10.0)?100:xx; 8. Build the First and Follow sets for the given context-free grammar. SgCABAaCBCbBcdAhCef 9. The following productions define the LL(1) grammarG. Given the First and Follow sets of G, complete the LL(1) parse table and parse the input string ' 0011$ '. Productions Firct and Follow Sets 1. SOB 2. A1A LL(1) Table 3. A 4. BSA 5. BA \begin{tabular}{lll} Parse Stack & Input & Action \\ \hline$S & 0011$ \end{tabular} 12. Which of the following characteristics of a programming language is best specified using a contextfree grammar? (Circle all answers.) (5) a. Identifier length c. Operator precedence e. Type conversion b. Maximum level of nesting d. Type compatibility When is a grammar a context-free grammar
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started