Document information
- University
- Politecnico di Milano
- Degree programme
- Computer Engineering
- Subject
- Formal Languages and Compilers
- Academic year
- 2017-2018
- Classification
- Other study material
- Original format
- Text
- Searchable text
University study material for Formal Languages and Compilers in the Computer Engineering degree programme at Politecnico di Milano. The document covers: Formal Languages and Compilers Proff. Breveglieri, Morzenti Written exam1: laboratory question 18/01/2018 SURNAME: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . NAME: . . . . . .
University study material for Formal Languages and Compilers in the Computer Engineering degree programme at Politecnico di Milano. The document covers: Formal Languages and Compilers Proff. Breveglieri, Morzenti Written exam1: laboratory question 18/01/2018 SURNAME: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . NAME: . . . . . .
Import quality: text was extracted directly from the original 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.
Formal Languages and Compilers Proff. Breveglieri, Morzenti Written exam1: laboratory question 18/01/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 foreach-every construct. The foreach-every construct iterates over an array without the need to explicitly handle the index of the array element. At each iteration, it runs the code block placed before the every keyword. On the first iteration, elem takes the value of v[0], on the second one is updated to v[1], on the third is updated to v[2] and so on for each element of the array. Every k iterations the construct executes once the code block placed after the do keyword instead of the normal loop body. The k parameter must be an expression whose value is known at compile time. Moreover, the behaviour of the foreach-every construct enforces the first iteration to always run the loop body that has been defined before the every keyword. The implementation must check: • the variable placed before the in keyword must be a scalar; • the variable placed after the in keyword must be an array; • the value of k must be positive and greater than 1; • the value…
First page of the document.