How do you think a compiler translates into machine language, a branch in the parse tree that looks like the diagram given in attached CompilerTranslate.doc? Show the code that can be generated from the production given in the diagram, and the semantic record created for the new nonterminal symbol <Boolean expression>.
See the attached file.© BrainMass Inc. brainmass.com October 16, 2018, 9:37 pm ad1c9bdddf
This response is just a guidance. Please adjust the assembly instructions as per your instruction set.
Semantic record for new nonterminal symbol <Boolean expression> : (temp, integer).
Solution gives a sample generated code, and a variation to it. The code is commented well to help you choose appropriate instructions from your instruction set, in case you are using a different assembly language.
Programming Languages Multiple Choice Questions
1. What does the term aliasing mean?
a. Having two names for the same memory cell
b. Having two referencing methods for the same memory cell
c. Both a and b.
d. Neither a nor b.
2. The most rigorous means of describing the meaning of a program is
called _________ semantics.
3. Lexical analysis is separated from syntax analysis because:
a. lexical analysis is less complex.
b. optimizing the lexical analyzer provides more benefits than
optimizing the syntax analyzer.
c. lexical analysis has to perform input/output operations and,
therefore, is platform dependent.
d. all of the above.
4. The output of _____ compilers must be linked to operating system
programs, especially __________ routines.
a. all; input/output
b. all; device drivers
c. some; input/output
d. some; device drivers
5. The extreme opposite of a compiler is known as a(n):
6. The following list contains steps that may/may not be part of the
process of compilation. Place the steps in the correct order that are
part of the compilation process, omitting those that are not part of
the compilation process.
i. lexical analysis
iv. semantic analysis
vi. code generation
vii. syntax analysis
a. i, ii, iii, iv, v
b. iv, i, vii, v, ii
c. i, vii, vi, iv, v, ii
d. vii, i, iv, v, vi, iii
e. i, vii, iv, v, vi
7. The data structure built by a compiler that represents the
hierarchical syntactic structure of a given program is called a(n)
8. How is Scheme opposite to Common Lisp?
a. Scheme is large and complex; Common Lisp is small.
b. Common Lisp is not an ANSI standard; Scheme is.
c. Scheme is exclusively statically scoped; Common Lisp supports
d. Common Lisp is interpreted; Scheme is compiled.
9. The primary progenitor of COBOL was the programming language
b. Short Code.
10. The C++ programming language is very popular because it is:
a. backward compatible with C.
c. widely available.
d. all of the above.
11. Plankalkül included the following features except:
a. (recursive) record structures.
b. ones-complement notation floating point type.
c. iterative statement.
12. For a large production application, a __________ language is most
likely to be used:
13. Java and Perl are examples of __________ languages.
14. What innovation introduced in ALGOL68 is often credited to Pascal?
a. user-defined data types
b. block statement
c. select statement
15. The syntax analysis part of a compiler is known as a:
a. language generator.
b. language recognizer.
c. context free grammar.
16. If the left-hand side (LHS) appears in the right-hand side (RHS) of a
rule, it is a(n):
17. A hierarchical structure that describes the syntactic structure of
sentences in a language is called a(n):
a. descendant chart.
b. family tree.
c. parse tree.
d. ancestor list.
e. none of the above.
18. An alternate term for lexical analyzer is:
a. pattern matcher.
c. pushdown automaton.
d. all of the above.
19. A concept of ________ means that a small number of primitive
constructs can be combined in a small number of ways to build the
control and data structures of the language.
20. The task of a bottom-up parser is to find the handle of any given
right sentential form that can be generated by its associated
21. A logical rule that is assumed to be true is termed a(n):
22. Using EBNF, the C selection statement is depicted as:
<selection> 􀃆 if (<expression>) <statement> [else <statement>];
Without brackets, how many BNF rules would be required to depict
the C selection statement?
d. More than 3
23. With a von Neumann architecture, assignment is based on:
a. pipelining operations.
b. piping operations.
c. iterative operations.
d. functional operations.
24. The most common programming languages, dating back to the
1940s are called:
25. Consider the rule: A 􀃆 A + B. Using a LL parser, this rule is
impossible to handle.