Exam1 - " (a + b) * c " using the...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
ICS 313 Fundamentals of Programming Languages (022) Exam I (15%) (75 Minutes) Student ID: N a m e : Question Max Mark 1 10 2 30 3 20 4 20 5 20 Total 100 30 March 2003
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Question 1 [5, 5] (a) Why is the readability of a programming language important? (b) One early computer language is described as an "ancestor" of most modern languages, including C, Java, Pascal, Ada, Smalltalk, and Visual Basic. What is that language?
Background image of page 2
Question 2 [6, 8, 8, 8] (a) What is aliasing? What is its effect on program reliability? (b) Which produces faster program execution, a compiler or a pure interpreter? Why is the other option any good? (c) Define syntax and semantics. (d) What is BNF? What is it used for?
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Question 3 [10, 10] (a) Prove that the following grammar is ambiguous: <S> <A> <A> <A> + <B> | <id> <B> <A> | <id> <id> x | y | z (b) Show a parse tree for the string
Background image of page 4
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 6
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: &quot; (a + b) * c &quot; using the following grammar: &lt;express&gt; → &lt;id&gt; + &lt;express&gt; | &lt;id&gt; * &lt;express&gt; | &lt;express&gt;) | &lt;id&gt; &lt;id&gt; → a | b | c Question 4 [10, 10] (a) Write a grammar for the language consisting of: n copies of the letter x followed by 2 n copies of the letter y . So &quot; xxyyyy &quot; would be in the language, but &quot; xxyyy &quot; would not. (b) Write a description in English of the strings that are valid according to the following grammar (starting from the non-terminal &lt;foo&gt; ): &lt;foo&gt; → 'a' [ &lt;bar&gt; ] &lt;bar&gt; → 'b' &lt;foo&gt; | 'c' &lt;foo&gt; Question 5 [20] 1. E → E + T 2. E → T 3. T → T * F 4. T → F 5. F → (E) 6. F → id Show a complete parse, including the parse stack contents, input string, and action for the string (id+id)*id , using the grammer and parse table above....
View Full Document

Page1 / 6

Exam1 - &amp;amp;quot; (a + b) * c &amp;amp;quot; using the...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online