New Semester
Started
Get
50% OFF
Study Help!
--h --m --s
Claim Now
Question Answers
Textbooks
Find textbooks, questions and answers
Oops, something went wrong!
Change your search query and then try again
S
Books
FREE
Study Help
Expert Questions
Accounting
General Management
Mathematics
Finance
Organizational Behaviour
Law
Physics
Operating System
Management Leadership
Sociology
Programming
Marketing
Database
Computer Network
Economics
Textbooks Solutions
Accounting
Managerial Accounting
Management Leadership
Cost Accounting
Statistics
Business Law
Corporate Finance
Finance
Economics
Auditing
Tutors
Online Tutors
Find a Tutor
Hire a Tutor
Become a Tutor
AI Tutor
AI Study Planner
NEW
Sell Books
Search
Search
Sign In
Register
study help
computer science
programming language pragmatics
Programming Language Pragmatics 4th Edition Michael L. Scott - Solutions
Give an example of a grammar that captures right associativity for an exponentiation operator (e.g., ** in Fortran).
(a) Describe in English the language defined by the regular expression a* ( b a* b a* )*. Your description should be a high-level characterization— one that would still make sense if we were using a different regular expression for the same language.(b) Write an unambiguous context-free grammar
Build a nested-case-statements finite automaton that converts all letters in its input to lower case, except within Pascal-style comments and strings. A Pascal comment is delimited by { and }, or by (* and *). Comments do not nest. A Pascal string is delimited by single quotes (' . . . '). A quote
Write a program in your favorite scripting language to remove comments from programs in the calculator language.
Build an ad hoc scanner for the calculator language. As output, have it print a list, in order, of the input tokens. For simplicity, feel free to simply halt in the event of a lexical error.
Starting with the regular expressions for integer and decimal, construct an equivalent NFA, the set-of-subsets DFA, and the minimal equivalent DFA. Be sure to keep separate the final states for the two different kinds of token. You may find the exercise easier if you undertake it by modifying the
(a) Show the NFA that results from applying the construction of Figure 2.7 to the regular expression letter ( letter | digit )*.(b) Apply the transformation illustrated to create an equivalent DFA.(c) Apply the transformation illustrated to minimize the DFA. (a) Base case A B (b) Concatenation AB A
Build a regular expression that captures all nonempty sequences of letters other than file, for, and from. For notational convenience, you may assume the existence of a not operator that takes a set of letters as argument and matches any other letter. Comment on the practicality of constructing a
Show (as “circles-and-arrows” diagrams) the finite automata for Exercise 2.1.Data from Exercise 2.1:Write regular expressions to capture the following.(a) Strings in C. These are delimited by double quotes ("), and may not contain newline characters. They may contain double-quote or backslash
Write regular expressions to capture the following.(a) Strings in C. These are delimited by double quotes ("), and may not contain newline characters. They may contain double-quote or backslash characters if and only if those characters are “escaped” by a preceding backslash. You may find it
The Unix make utility allows the programmer to specify dependences among the separately compiled pieces of a program. If file A depends on file B and file B is modified, make deduces that A must be recompiled, in case any of the changes to B would affect the code produced for A. How accurate is
In your local implementation of C, what is the limit on the size of integers? What happens in the event of arithmetic overflow? What are the implications of size limits on the portability of programs from one machine/compiler to another? How do the answers to these questions differ for Java? For
Both interpretation and code generation can be performed by traversal of a syntax tree. Compare these two kinds of traversals. In what ways are they similar/different?
The gcd program of Example 1.20 might also be writtenint main() { int i = getint(), j = getint(); while (i != j) { if (i > j) i = i % j; else j = j % i;}putint(i);}Does this program compute the same result? If not,
Imperative languages like Fortran and C are typically compiled, while scripting languages, in which many issues cannot be settled until run time, are typically interpreted. Is interpretation simply what one “has to do” when compilation is infeasible, or are there actually some advantages to
Consider again the Pascal tool set distributed by Niklaus Wirth. After successfully building a machine language version of the Pascal compiler, one could in principle discard the P-code interpreter and the P-code version of the compiler. Why might one choose not to do so?
Errors in a computer program can be classified according to when they are detected and, if they are detected at compile time, what part of the compiler detects them. Using your favorite imperative language, give an example of each of the following.(a) A lexical error, detected by the scanner(b) A
Showing 800 - 900
of 817
1
2
3
4
5
6
7
8
9
Step by Step Answers