Back
Other

Tema 130716

University study material for Formal Languages and Compilers in the Computer Engineering degree programme at Politecnico di Milano. The document covers: Formal Languages and Compilers Proff. Breveglieri, Morzenti Written exam1: laboratory question 13/07/2016 SURNAME: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . NAME: . . . . . .

Formal Languages and CompilersOther

Document information

What's included in this study material

University study material for Formal Languages and Compilers in the Computer Engineering degree programme at Politecnico di Milano. The document covers: Formal Languages and Compilers Proff. Breveglieri, Morzenti Written exam1: laboratory question 13/07/2016 SURNAME: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . NAME: . . . . . .

Import quality: text was extracted directly from the original document.

Extracted content from the document

Representative passages recognised in different parts of the material. The full extracted text remains available to search, while this compact preview makes the page easier to read.

Page 1

Formal Languages and Compilers Proff. Breveglieri, Morzenti Written exam1: laboratory question 13/07/2016 SURNAME: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . NAME: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Student ID:. . . . . . . . . . . . . . . . Course: ◦ Laurea Specialistica ◦ V. O. ◦ Laurea Triennale ◦ Other: . . . Instructor: ◦ Prof. Breveglieri ◦ Prof Morzenti The laboratory question must be answered taking into account the implementation of the Acse compiler given with the exam text. Modify the specification of the lexical analyser ( flex input) and the syntactic analyser (bison input) and any other source file required to extend the Lance language with the if statement with initializer construct. The construct allows a programmer to specify, withing the round braces following theif keyword of a common if-statement both the condition which should be holding true, and an arbitrary statement. The entire statement, including its mandatory terminating semicolon is prefixed to the usual if-statement condition. The if statement with initializer construct is denoted by the iif keyword in place of the usual if. An example is provided in the following code snippet int i,j; i=5; j=7 iif (i=i+2; (j *5)>i){ j = i; } The computation of the initializing statement is always executed before the evaluation of the condition of the if statement is evaluated and its usual behaviour is followed, i.e., the code block is executed if the condition is true. 1Time 60’. Textbooks and notes can be used. Pencil writing is allowed. Write your name on any additional sheet. 1 1. Define the tokens (and the related declarations in Acse.lex…

Preview

First page of the document.

First page: Tema 130716