预定/报价
编译代写|CS 3500 – Programming Languages & Translators Exam #2
阿叶2024-05-14 15:27:39
留学生作业代写do not hesitate to contact me!
WeChat:lovexc60


For problems 1 through 10 select the SINGLE (best) answer. Each of these questions is
worth 1 point.

1. When do undeclared identifiers get detected in MFPL?
a. when recognizing the ident token in the flex specification file
b. when processing the ident in EXPR → ident
c. when processing the ident in ID_LIST → ID_LIST ident for a LAMBDA_EXPR
d. when processing the ident in ID_EXPR_LIST → ID_EXPR_LIST ( ident EXPR )
for a LET_EXPR

2. In the MFPL programming language used for HW #3 and #4, a scope is opened
(i.e., a symbol table is created):

a. as soon as we start up the interpreter
b. whenever we process a left parenthesis
c. whenever we process a progn expression
d. whenever we process a let* expression
e. all of the above

3. If processing a production A → B { } C D, bison would refer to C as:

a. $1
b. $2
c. $3
d. $4
e. $$

4. According to the specifications of HW #4, which arg would we flag an error on in the
following MFPL expression:
(<= “Ryan the dog” 150) ; she actually only weighs 110 lbs

a. Arg 1
b. Arg 2
c. Arg 3
d. This is a trick question – there is no error!

5. According to the specifications of HW #4, which arg would we flag an error on in the
following MFPL expression:
(print (print (+ “Hello” “world!”)))

a. Arg 1
b. Arg 2
c. Arg 3
d. Arg 4
e. This is a trick question – there is no error!

6. Based on the way you were supposed to implement HW #4, recursive function
calls are allowed in MFPL.

a. TRUE b. FALSE

7. In the MFPL statement below, how many symbol tables should be open at the
time that (f x) is parsed?

(let* ( (x 1)
(f (lambda (a)
(let* ( (y (input))
)
(print (* a y))
)
)
)
)
(f x)
)

a. 1
b. 2
c. 3
d. none of the above is correct