
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Consider a CFL for Java if-statements:
G = ({<STMT>, <IF-THEN>, <IF-THEN-ELSE>}, {if, condition, else, (, ), stmt}, R, <STMT>)
where R is:
<STMT> → stmt | <IF-THEN> | <IF-THEN-ELSE>
<IF-THEN> → if ( condition ) <STMT>
<IF-THEN-ELSE> → if ( condition ) <STMT> else <STMT>
Show that G is ambiguous and give a different, unambiguous grammar for the same language that corresponds to Java semantics.
Expert Solution

arrow_forward
Step 1
Given grammar G = ({<STMT>, <IF-THEN>, <IF-THEN-ELSE>}, {if, condition, else, (, ), stmt}, R, <STMT>)
where R is:
<STMT> → stmt | <IF-THEN> | <IF-THEN-ELSE>
<IF-THEN> → if ( condition ) <STMT>
<IF-THEN-ELSE> → if ( condition ) <STMT> else <STMT>
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 3 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Formalize the following sentence in english: Vx. (even(X) => divisible_by_two(X))arrow_forwardConsider the following recursive definition to define a language L over the alphabet S={0,1}: Base Step: 1∈L Recursion Step: For each w in L, 0w0 is in L. Each string in L can be derived from the base step together with a finite number of applications of the recursion step. a) List two string in L. b) List two strings not in L. c) Write set notation to describe L.arrow_forwardGive a brief explanation of the idea of operator precedence.arrow_forward
- De Morgan’s laws state that specific Boolean statements can be written in different ways with the same meaning. A group of negated ANDs is the same as a negated group of ORs (!a && !b && !c) === !(a || b || c) A group of negated ORs is the same as a negated group of ANDs (!a || !b || !c) === !(a && b && c) Which construction would you use if your programming code needed to check if at least one of a,b,c is true? Which construction would you use if your programming code needed to check that a,b,c are all true? Explain your reasoning about choosing the programming code.arrow_forward26. Which is the correct statement(s) for Non Recursive predictive parser?S1: First(α) = {t | α => * t β for some string β } => *tβS2: Follow(X) = { a | S => * αXa β for some strings α and β } a. Both statements S1 and S2 are incorrect b. S1 is incorrect and S2 is correct c. S1 is correct and S2 is incorrect d. Both statements S1 and S2 are correctarrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education