Concepts Of Programming Languages
12th Edition
ISBN: 9780134997186
Author: Sebesta, Robert W.
Publisher: Pearson,
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 3, Problem 1PS
The two mathematical models for language description are:
- Recognition
- Generation
These two mathematical models can define the syntax of
Recognition:
- It works on yes or no basis. In this method, a
mechanism called recognition device (R) is used that can read strings from the given alphabet. - This would indicate whether the input string is in language or not. That means, it will either accept the string or reject the string.
- Recognition device filters the correctly formed sentences from those that are incorrectly formed.
- In recognition, recognizer is used for syntax. analysis. Recognizer does not check for all possible strings but it simply check if the given programs are in the language or not.
- It checks the syntactical part of the program.
Generation:
- In this method, a device named generator is used to generate the sentences in a language.
- Whenever a generator is called, it generator a sentence which is unpredictable.
- When a string is to be checked if it is a correct or incorrect, first of all, it calls the generator to generate a correct sentence.
- Then, it compares the correct generated string with the input string.
- Hence, it determines the correction in string.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
can you help me with this questin because I don't understand it and I am having trouble with this can you do this step. by step and explain it in great detail and can you do something visual to help me understand it better.
question:1.40 Recall that string x is a prefix of string y if a string z exists where xz = y, and that x is a proper prefix of y if in addition x 6= y. In each of the following parts, we define an operation on a language A. Show that the class of regular languages is closed under that operation.
b. NOEXTEND(A) = {w ∈ A| w is not the proper prefix of any string in A}
I need help with my program. It needs to:
Developing a language model based on the context-free grammar: Use the context-free grammar to develop a language model that can be used to generate coherent and grammatically correct sentences in American English.
Incorporating semantic information into the context-free grammar: Expand the context- free grammar to incorporate semantic information, such as word meaning and context, to generate more meaningful sentences in American English.
import java.util.*;import java.util.stream.Collectors;public class CFG { private static Map<String, List<String>> rules; public static void main(String[] args) { rules = new HashMap<>(); initializeGrammarRules(); String sentence = generateSentence("S"); System.out.println(sentence); } private static void initializeGrammarRules() { rules.put("S", Arrays.asList("NP VP")); rules.put("NP", Arrays.asList("Det N", "Det AP N"));…
1.1 OBJECTIVE:Design a lexical analyzer for given language and the lexical analyzer should ignore redundant spaces, tabs and new lines. It should also ignore comments. Although the syntax specification states that identifiers can be arbitrarily long, you may restrict the length to some reasonable value. Simulate the same in C language.
1.2 PROGRAM LOGIC:
Read the input Expression
2. Check whether input is alphabet or digits then store it as identifier
3. If the input is is operator store it as symbol
4. Check the input for keywords
Chapter 3 Solutions
Concepts Of Programming Languages
Ch. 3 - Prob. 1RQCh. 3 - Prob. 2RQCh. 3 - Prob. 3RQCh. 3 - Prob. 4RQCh. 3 - Prob. 5RQCh. 3 - Prob. 6RQCh. 3 - Prob. 7RQCh. 3 - Prob. 8RQCh. 3 - Prob. 9RQCh. 3 - What is the difference between a synthesized and...
Ch. 3 - Prob. 11RQCh. 3 - Prob. 12RQCh. 3 - Prob. 13RQCh. 3 - Prob. 14RQCh. 3 - Prob. 15RQCh. 3 - Prob. 16RQCh. 3 - Prob. 17RQCh. 3 - Prob. 18RQCh. 3 - Prob. 19RQCh. 3 - Prob. 20RQCh. 3 - Prob. 21RQCh. 3 - What does partial correctness mean for a loop...Ch. 3 - Prob. 23RQCh. 3 - Prob. 24RQCh. 3 - Prob. 25RQCh. 3 - Prob. 26RQCh. 3 - Prob. 27RQCh. 3 - Prob. 28RQCh. 3 - Prob. 29RQCh. 3 - The two mathematical models for language...Ch. 3 - Write EBNF descriptions for the following: a. A...Ch. 3 - Prob. 3PSCh. 3 - Prob. 4PSCh. 3 - Prob. 5PSCh. 3 - Prob. 6PSCh. 3 - Prob. 9PSCh. 3 - Prob. 10PSCh. 3 - Prob. 12PSCh. 3 - Prob. 15PSCh. 3 - Prob. 16PSCh. 3 - Prob. 17PSCh. 3 - Prob. 18PSCh. 3 - Compute the weakest precondition for each of the...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
State whether each of the following is true or false. An algorithm is a procedure for solving a problem in term...
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
3.12 (Date Create a class called Date that includes three pieces Of information as data
members—a month (type ...
C++ How to Program (10th Edition)
Show a snippet of PHP code for creating a recordset. Explain the meaning of the code.
Database Concepts (8th Edition)
(TicTacToe Class) Create a class TicTacToe that will enable you to write a complete program to play the game of...
C How to Program (8th Edition)
Describe the values that should he returned from functions that overload relational operators.
Starting Out with C++: Early Objects (9th Edition)
An informal language that has no syntax rules, and is not meant to be compiled or executed is called _____. a. ...
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
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
- Hello , the question below is from concepts of programming languages book by Robert sebasta , Q) Write an attribute grammar whose BNF basis is that of Example 3.6 inSection 3.4.5 but whose language rules are as follows: Data types cannotbe mixed in expressions, but assignment statements need not have thesame types on both sides of the assignment operator.Example 3.6 is attached as image . P.S : please explain the answer to me as I have shared the question twice today but the answer didn't convince me.arrow_forwardPlease explain parametric polymorphism and provide an example of a subprogram that uses it.arrow_forwardDesign FSMs that will recognise the following languages. Some of these languagesare given simply as sets of strings (and hence there should be no doubt what themachine must recognise). Others are described using English, and there may wellbe a lack of clarity in these descriptions. You should make clear any assumptionsthat you have made in interpreting what the machine needs to do. The alphabetfor all the machines is {x,y, z}.1. {xy, xz}.2. Two x symbols followed by one y and zero or more zs.3. {xxy, xzy, xy}.4. At least one x followed by exactly one y followed by zero or more zs.arrow_forward
- Peter Sestof - Programming Language Concept Exercise 12.5 Improve the compilation of assignment expressions that are really just increment operations, such as thesei = i + 1a[i] = a[i] + 1It is easiest to recognize such cases in the abstract syntax, not by looking at the code continuation.arrow_forwardDefine denotational semantics for the language of octal (base 8) numerals. Use the definition to find the value of “752”. You must define M_dec as a semantic function that maps syntactic objects written as octal numbers (with no decimal points, i.e., no fractions) to a set of non-negative decimal integer values. For Example, given the octal string “752” then: M_dec(“752”) would return 490 as its equivalent decimal value.arrow_forwardarrow_forward Step 1 Context Free Grammar: A formal language that is used to generate all possible strings in a given formal language is called context free grammar. It can be defined as: G=(V, T, P, S) Where G specifies the grammar V specifies the finite set of non-terminal symbols. T specifies the finite set of terminal symbols. P specifies the set of production rules. S specifies the start symbol. The start symbol S is used to derive a string in a context free grammar. It is derived by repeatedly replacing a non-terminal symbol by the right-hand-side production until all the non-terminal symbols have been replaced by the terminal symbols. arrow_forward Step 2 G is a context-free grammar for a language L, and L contains only strings of length 2 or greater. We have to prove that there is a context-free grammar Gd which generates L such that every rule in Gd has the form A -> x1x2, where A is a terminal and each xi is a terminal or a non-terminal. Let the alphabet of…arrow_forward
- Given: Language L2 = {w ϵ {a,b}* | w contains substring aab} Construct the DFA representing the given language L2. Assume the layout of the DFA is as follows: ->A->B->C->D*. That is, the number of states are four (4) and A is the starting state and D is the accepting state. What is the next state for input pair (B,b) in the constructed DFA? Choices A B C Darrow_forwardTopic: Concepts of programming Language Compute the weakest precondition for the following selection construct andthe postconditions.b = 5 * (2 * a + b);a = 3 * b + 1 {a > 10}arrow_forwardSeveral different categories of semantics exist, each with its own advantages and disadvantages.arrow_forward
- Is there any reason why modern programming languages can't do without pass-by-value and pass-by-reference constructs? Why is it that we can't just choose one of these? Please address the benefits of having both and the drawbacks of having either alone in your answer.arrow_forwardGiven: Language L2 = {w ϵ {a,b}* | w contains substring aab} Construct the DFA representing the given language L2. Assume the layout of the DFA is as follows: ->A->B->C->D*. That is, the number of states are four (4) and A is the starting state and D is the accepting state. What is the next state for the input pair (D,b) in the constructed DFA? A B C Darrow_forwardComputer Science Write the parser code in java to implement the cky parsing(bottom up approach) A. Input to the parser: a sentence at a time B. Output from the parser: Yes/No (to indicate the sentence is accepted and valid, or not accepted and invalid)arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
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
Structured Chart; Author: Tutorials Point (India) Ltd.;https://www.youtube.com/watch?v=vdUO-sGA1DA;License: Standard YouTube License, CC-BY
Introduction to Structure Charts; Author: Christopher Kalodikis;https://www.youtube.com/watch?v=QN2bjNplGlQ;License: Standard Youtube License