← Back
OtherItalian

Tema 060913

Study material for Formal Languages and Compilers, shared by the Studwiz community and reviewed by moderators.

Formal Languages and CompilersOther

Document information

What's included in this study material

Study material for Formal Languages and Compilers, shared by the Studwiz community and reviewed by moderators.

Import quality: text was extracted directly from the original document.

Extracted content from the 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.

Page 1

Linguaggi Formali e Compilatori Proff. Breveglieri, Crespi Reghizzi, Morzenti Prova scritta 1: Domanda relativa alle esercitazioni 06/09/2013 COGNOME: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . NOME: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Matricola: . . . . . . . . . . . . . . . . Corso: ◦ Laurea Specialistica ◦ V. O. ◦ Laurea Triennale ◦ Altro: . . . Sezione: ◦ Prof. Breveglieri ◦ Prof. Crespi ◦ Prof.Morzenti Per la risoluzione della domanda relativa alle esercitazioni si deve utilizzare l’imple- mentazione del compilatore Acse che viene fornita insieme al compito. Si richiede di modificare la specifica dell’analizzatore lessicale da fornire a flex, quella dell’analizzatore sintattico da fornire a bison ed i file sorgenti per cui si ritengono necessarie delle modifiche in modo da estendere il compilatore Acse con la possibilit` a di gestire il costrutto either-or-on. int a, z, b, k; // ... either { read(a); a = a - 99; } or { z = 27; a = z - b; a = a * a; } on a < 27 * k; Figura 1: Esempio Il costrutto either-or-on ` e simile al costruttoif-then-else: quando la condizione (spe- cificata dopo la keyword on) ` e verificata sar` a eseguito il bloccoeither, altrimenti sar` a eseguito il blocco or. 1Tempo 60’. Libri e appunti personali possono essere consultati. `E consentito scrivere a matita. Scrivere il proprio nome sugli eventuali fogli aggiuntivi. 1 1. Definire i token (e le relative dichiarazioni in Acse.lex e Acse.y) necessari per ottenere la funzionalit` a richiesta. (3 punti) 2. Definire le regole sintattiche (o le modifiche a quelle esistenti) necessarie per ottenere la funzionalit` a richiesta. (4 punti) 3.…

Preview

First page of the document.

First page: Tema 060913