← Indietro
Altro

Tema 300916

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 30/09/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 merge operator. The merge operator is a ternary operator, having precedence lower than all the operators, save for the assignment one. The syntax of the merge operator is the following: the expression involving it starts with themerge keyword followed by the three operands, separated by commas. The result of the expression containing the merge operator coincides with its first operand, if its third operand equals one, while it coincides with the second operand if the third one equals zero. Note that the result of any expression, including constant ones must be admissible as an operand of the merge operator. The implementation must handle properly constant folding. The following code provides an example of the syntax of the said operator. 1 int a,b,c; 2 3 a=7; 4 b=2; 5 c = merge a,b,a>b; 6 write(c); /* this will print 7 */ 7 8 c = merge 2,3,0; 9 write(c); /* this will print 3 */ 1Time 60’. Textbooks and notes can be used. Pencil writing…

Anteprima

Prima pagina del documento.

Prima pagina: Tema 300916