Back
Other

Tema 050717

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 and Morzenti Written exam1: laboratory question 05/07/2017 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 and Morzenti Written exam1: laboratory question 05/07/2017 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 and Morzenti Written exam1: laboratory question 05/07/2017 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 domain of expressions of Lance language with the representation of positive and negative infinite values and the undefined value. At runtime, each expression is represented by means of a value and a descriptor inf : “value” is either the integer value of the expression, when the expression is defined and different from an infinite, or the sign of the infinite (+ /−). Value “inf” specifies if the expression is an integer or an infinite or if it is an undefined value. Two new constants are introduced in the language to represent infinite values (i.e., +infty and -infty) and one is added to represent the undefined value (NaN). The following example shows the use of infinite values in case of assignment in- structions and conditional expressions of the form exp == exp, the latter being defined according to the following semantics: • if an undefined is compared with an expression the resulting expression is undefined. • Otherwise, the resulting expression is defined and the value of the…

Preview

First page of the document.

First page: Tema 050717