Informazioni sul documento
- Università
- Politecnico di Milano
- Corso di laurea
- Computer Engineering
- Materia
- Formal Languages and Compilers
- Anno accademico
- 2016-2017
- Classificazione
- Altro materiale
- Formato originale
- Testo
- Testo ricercabile
Altro di Formal Languages and Compilers per il corso di Computer Engineering presso Politecnico di Milano. Materiale proveniente dall’archivio storico Studwiz e classificato per la consultazione online.
Altro di Formal Languages and Compilers per il corso di Computer Engineering presso Politecnico di Milano. Materiale proveniente dall’archivio storico Studwiz e classificato per la consultazione online.
Qualità dell’importazione: il testo è stato estratto direttamente dal documento originale.
Passaggi rappresentativi riconosciuti nelle diverse parti del materiale. Il testo completo resta presente nella pagina per la ricerca, mentre l’anteprima compatta rende più semplice la lettura.
Formal Languages and Compilers Proff. Breveglieri and Morzenti Written exam1: laboratory question 02/02/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 theLance language with the operator (bit). The operator can be written in front of a variable identifier . It transforms a vector v of integers into an integer, according to the following semantics: if v[i] is 0 then the i-th corresponding bit of ( bit)v is 0, otherwise if v[i] is non 0 then the i-th corresponding bit is 1. In any case, at most 32 elements of the vector are considered ( int variables are defined over 32 bits). Note that, if (bit) is applied in front of an identifier of a scalar, the returned value is the same as the one stored in the variable (namely, no translation is carried out). int v1[3]; int v2[1]; int v3[40]; int x = 10; //v1 encodes 110 v1[2] = 15; v1[1] = 79; v1[0] = 0; //v2 encodes 1 v2[0] = 1; //v3 encodes -2ˆ(31) v3[31]=37; write((bit)v1); //output 6 write((bit)v2); //output 1 write((bit)v3); //output -2ˆ(31) write((bit)x); //output 10 1Time 60’. Textbooks and notes can be used. Pencil writing is allowed. Write your name on any additional sheet. 1 1.…
Prima pagina del documento.