Document information
- University
- Politecnico di Milano
- Degree programme
- Computer Engineering
- Subject
- Formal Languages and Compilers
- Academic year
- 2017-2018
- Classification
- Other study material
- Original format
- Text
- Searchable text
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 18/06/2018 SURNAME: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . NAME: . . . . . .
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 18/06/2018 SURNAME: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . NAME: . . . . . .
Import quality: text was extracted directly from the original 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.
Formal Languages and Compilers Proff. Breveglieri, Morzenti Written exam1: laboratory question 18/06/2018 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 new exists construct. The new construct implements the first-order existential quantification over the positions of the array appearing in the expression between parenthesis. The identifier used to access the array positions is defined after the keyword exists. Possible clashes are handled according to the semantics of the first-order logic: the inner-most identifier is considered for accessing the array. No nested exists are allowed, hence the implementation should provide a proper syntactical check. The following restriction is considered: only one array identifier occurs in the expression of any exists construct (hence, no checks has to be implemented). An example is provided in the following. int a[5]; int x = 3; a[0] = 0; a[1] = 1; a[2] = 2; a[3] = 3; a[4] = 4; if ( exists i (a[i]>2) ) write(1); else write(0); // it prints 1 if ( exists i (a[x]>2) ) write(1); else write(0); // it prints 1 if ( exists x (a[x]>10) ) write(1); else…
First page of the document.