← Indietro
Altro

Tema 180618

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, 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…

Anteprima

Prima pagina del documento.

Prima pagina: Tema 180618