← Indietro
Altro

Tema 080715

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.

Formal Languages and CompilersAltro

Informazioni sul documento

Cosa trovi in questo materiale

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.

Contenuti estratti dal documento

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.

Pagina 1

Formal Languages and Compilers Proff. Breveglieri, Crespi Reghizzi, Morzenti Written exam1: laboratory question 08/07/2015 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 permutate construct for arrays. An example is provided in the following. int arr[10]; // arr = [ 10, 11, 12, 13, 14, 15 ] permutate( arr, q[ 4, 2, 0 ]p ); // arr = [ 12, 11, 14, 13, 10, 15 ] The permutation is expressed as constant vector of indices, i.e. integer constants, that must be interpred as source-destination indices pairs. For example the chain q[4, 2, 0]p: • element in position 4 of the input array goes into position 2 of the output array • element in position 2 of the input array goes into position 0 of the output array • element in position 0 of the input array goes into position 4 of the output array A graphical representation of the semantic is the following: 10 11 12 13 14 15 12 11 14 13 10 15 The permutation must be inplace, meaning that the input array is modified to obtain the output array without the need of a temporary array. Note that the vector of indices can be shorter or longer than the length of the array. Indeed…

Anteprima

Prima pagina del documento.

Prima pagina: Tema 080715