User Tools

Site Tools


compilers
Return to Home page

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Previous revision
compilers [2020/06/11 11:13]
compilers [2021/06/16 11:33] (current)
zioskenz [Slides (Practice in classroom)]
Line 1: Line 1:
 +====== Formal Languages and Compilers Course (year 2020/2021) ======
 +**Assistant:** Stefano Scanzio\\
 +**www:** [[https://www.skenz.it/ss]]\\
 +**email:** stefano.scanzio [ AT_SYMBOL ] polito.it
  
 +===== News =====
 +  * [2021/06/01]: Add 20200720.pdf exam
 +  * [2021/06/01]: All the material of the practical part of the course has been added, including the commented solution of an exam [[https://www.skenz.it/compilers/exam_20150903|exam_20150903]]
 +
 +/*
 +  * Added slides of the sixth classroom practice, solutions of the sixth laboratory, and text of the seventh laboratory
 +  * [2021/05/14]: Added slides of the fifth classroom practice, solutions of the fifth laboratory, and text of the sixth laboratory
 +  * [2021/05/03]: Added slides of the fourth classroom practice, solutions of the fourth laboratory, and text of the fifth laboratory
 +  * [2021/04/25]: Added slides of the third classroom practice, solutions of the third laboratory, and text of the fourth laboratory
 +  * [2021/04/18]: Added slides of the second classroom practice, solutions of the second laboratory, and text of the third laboratory
 +  * [2021/04/07]: Added assignments for the 2020/2021 academic year: [[compilers:Assignments20202021]]
 +  * [2021/04/06]: Added text of the second laboratory
 +  * [2021/03/24]: Added solution of the first laboratory
 +  * [2021/03/24]: Added guideline for installation of need tools in macOS
 +  * [2021/03/23]: Added text of the first laboratory
 +  * [2021/03/14]: Updated guide for Jflex and Cup installation in Windows: [[compilers:Install Windows]]
 +  * [2021/03/01]: Added material for the 2020/2021 course
 +
 +/*
 +  * [2020/06/11]: All the material of the course has been published.
 +  * [2020/06/08]: Added exams that will be commented in 2020/06/11 lesson, and commented solution [[https://www.skenz.it/cs/jflex_cup/exam_20150903|IMP: exam_20150903]]
 +  * [2020/05/26]: Added slides of the sixth classroom, text of the seventh laboratory, and solutions of the sixth laboratory
 +  * [2020/04/16]: Added [[compilers:assignments]] for the 2019/2020 academic year
 +  * The material of the course will be uploaded in the course website some days before each lesson/laboratory
 +*/
 +
 +===== Calendar =====
 +  * [2021/06/01] from 14:30 to 16:30/17:00 (VC "Portale della Didattica") -> Seventh classroom practice
 +  * [2021/05/27] from 16:00 to 19:00 (VC "Portale della Didattica") -> Seventh laboratory
 +  * [2021/05/25] from 16:00 to 17:30 (VC "Portale della Didattica") -> Sixth classroom practice
 +  * [2021/05/20] from 16:00 to 19:00 (VC "Portale della Didattica") -> Sixth laboratory
 +  * [2021/05/18] from 14:30 to 16:30 (VC "Portale della Didattica") -> Fifth classroom practice
 +  * [2021/05/06] from 16:00 to 19:00 (VC "Portale della Didattica") -> Fifth laboratory
 +  * [2021/05/04] from 16:00 to 17:30 (VC "Portale della Didattica") -> Fourth classroom practice
 +  * [2021/04/29] from 16:00 to 19:00 (VC "Portale della Didattica") -> Fourth laboratory
 +  * [2021/04/27] from 16:00 to 17:30 (VC "Portale della Didattica") -> Third classroom practice
 +  * [2021/04/22] from 16:00 to 19:00 (VC "Portale della Didattica") -> Third laboratory
 +  * [2021/04/20] from 16:00 to 17:30 (VC "Portale della Didattica") -> Second classroom practice
 +  * [2021/04/08] from 16:00 to 19:00 (VC "Portale della Didattica") -> Second laboratory
 +  * [2021/03/25] from 17:30 to 19:00 (VC "Portale della Didattica") -> First laboratory (Group 2: M-Z)
 +  * [2021/03/25] from 16:00 to 17:30 (VC "Portale della Didattica") -> First laboratory (Group 1: A-L)
 +  * [2021/03/23] from 21:00 to 22:30 (VC "Portale della Didattica") -> Tutoring about tool installation
 +  * [2021/03/18] from 16:00 to 17:30 (VC "Portale della Didattica") -> First classroom practice
 +
 +
 +
 +
 +
 +/*
 +  * [2020/06/11] from 14:30 to 16:00/16:30 (Virtual Classroom "Portale della Didattica") -> **Commented exams**
 +  * [2020/06/08] from 08:30 to 11:30 (Virtual Classroom "Portale della Didattica") -> Seventh laboratory
 +  * [2020/05/29] from 14:30 to 16:00 (Virtual Classroom "Portale della Didattica") -> Sixth classroom practice
 +  * [2020/05/25] from 08:30 to 11:30 (Virtual Classroom "Portale della Didattica") -> Sixth laboratory
 +  * [2020/05/22] from 14:30 to 16:00 (Virtual Classroom "Portale della Didattica") -> Fifth classroom practice
 +  * [2020/05/18] from 08:30 to 11:30 (Virtual Classroom "Portale della Didattica") -> Fifth laboratory
 +  * [2020/05/15] from 14:30 to 16:00 (Virtual Classroom "Portale della Didattica") -> Fourth classroom practice
 +  * [2020/05/11] from 08:30 to 11:30 (Virtual Classroom "Portale della Didattica") -> Fourth laboratory
 +  * [2020/05/08] from 14:30 to 16:00 (Virtual Classroom "Portale della Didattica") -> Third classroom practice
 +  * [2020/04/27] from 08:30 to 11:30 (Virtual Classroom "Portale della Didattica") -> Third laboratory
 +  * [2020/04/24] from 14:30 to 16:00 (Virtual Classroom "Portale della Didattica") -> Second classroom practice
 +  * [2020/04/20] from 08:30 to 11:30 (Virtual Classroom "Portale della Didattica") -> Second laboratory
 +  * [2020/04/06] from 10:00 to 11:30 (Virtual Classroom "Portale della Didattica") -> First laboratory (Group 2: M-Z)
 +  * [2020/04/06] from 08:30 to 10:00 (Virtual Classroom "Portale della Didattica") -> First laboratory (Group 1: A-L)
 +  * [2020/03/27] from 14:30 to 16:00 (Virtual Classroom "Portale della Didattica") -> First classroom practice
 +*/
 +
 +===== Tools installation =====
 +
 +==== VLAIB link (To use the software provided by Polito) ====
 +Connect to VM: [[https://laibathome.polito.it/]] (to enter use "s123456@studenti.polito.it" as id, the "Portale della didattica" password, and "POLITO").\\ Guide about VLAIB: [[https://www.areait.polito.it/docs/SERV_354_3.PDF]]
 +
 +==== Installation in your PC ====
 +[[compilers:Install Windows]]: How to download and install Jflex, Java, and Cup in the Windows operating system\\
 +[[compilers:Install Linux Bash]]: How to download, install and configure Jflex, Java, and Cup in the Ubuntu Linux operating system with bash shell\\
 +[[compilers:Install macOS]]: How to download, install and configure Jflex, Java, and Cup in the macOS operating system\\
 +
 +/*
 +==== Virtual Machine ====
 +All the needed tools were already installed in the virtual machine for **VirtualBox** with Linux you can download here: [[https://www.skenz.it/repository/compilers/progs/FLC.ova.zip|FLC.ova.zip]] (size: 3.9 GBytes, the password of the zip file will be provided the first practice lesson).
 +*/
 +
 +===== Slides (Practice in classroom) =====
 +  * **Practice 1**: [[https://www.skenz.it/repository/compilers/classroom/practice1_1.pdf|practice1_1.pdf]], [[https://www.skenz.it/repository/compilers/classroom/practice1_2.pdf|practice1_2.pdf]], [[https://www.skenz.it/repository/compilers/classroom/practice1_6.pdf|practice1_6.pdf]]\\ Regular expressions and the scanner JFlex\\ Other material: Context dependent regular expressions, inclusive states and exclusive states in Jflex\\ <html><iframe width="250" height="140" src="https://www.youtube.com/embed/ho07RTTFENk" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></html>\\ Classroom example: [[https://www.skenz.it/repository/compilers/classroom/exClass-1.zip|exClass-1.zip]].\\ To compile and execute type the following commands:<code bash>
 +jflex exp.jflex
 +javac Calc.java
 +java Calc example_expr.txt
 +</code>
 +
 +  * **Practice 2**: [[https://www.skenz.it/repository/compilers/classroom/practice2_1.pdf|practice2_1.pdf]], [[https://www.skenz.it/repository/compilers/classroom/practice2_2.pdf|practice2_2.pdf]], [[https://www.skenz.it/repository/compilers/classroom/practice2_6.pdf|practice2_6.pdf]]\\ Grammar and introduction of Cup\\ Example: [[https://www.skenz.it/repository/compilers/classroom/exClass-2.zip|exClass-2.zip]].\\ Video on how to compile the example:\\ <html><iframe width="250" height="140" src="https://www.youtube.com/embed/9zK-T8RuWM8" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></html>\\ To compile and execute the example type the following commands:<code bash>
 +jflex scanner.jflex
 +java java_cup.MainDrawTree parser.cup
 +javac *.java
 +java Main example_expr.txt
 +</code>
 +  * **Practice 3**: [[https://www.skenz.it/repository/compilers/classroom/practice3_1.pdf|practice3_1.pdf]], [[https://www.skenz.it/repository/compilers/classroom/practice3_2.pdf|practice3_2.pdf]], [[https://www.skenz.it/repository/compilers/classroom/practice3_6.pdf|practice3_6.pdf]]\\ Ambiguous grammars, Lists, Handling syntax errors\\ Additional material: complex example about shift/reduce conflicts: [[https://www.skenz.it/repository/compilers/classroom/exClass-4.zip|exClass-4.zip]]\\ <html><iframe width="250" height="140" src="https://www.youtube.com/embed/GIyU2wXNXOk" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></html>
 +  * **Practice 4**: [[https://www.skenz.it/repository/compilers/classroom/practice4_1.pdf|practice4_1.pdf]], [[https://www.skenz.it/repository/compilers/classroom/practice4_2.pdf|practice4_2.pdf]], [[https://www.skenz.it/repository/compilers/classroom/practice4_6.pdf|practice4_6.pdf]]\\ Semantic: Synthesized attributes\\ Classroom example: [[https://www.skenz.it/repository/compilers/classroom/exClass-4b.zip|exClass-4b.zip]]\\ Additional material: debugging features of the Cup parser\\ <html><iframe width="250" height="140" src="https://www.youtube.com/embed/XkkuGMzKyRA" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></html>
 +  * **Practice 5**: [[https://www.skenz.it/repository/compilers/classroom/practice5_1.pdf|practice5_1.pdf]], [[https://www.skenz.it/repository/compilers/classroom/practice5_2.pdf|practice5_2.pdf]], [[https://www.skenz.it/repository/compilers/classroom/practice5_6.pdf|practice5_6.pdf]]\\ Semantic: Inherited attributes\\ Classroom example (Inherithed attributes): [[https://www.skenz.it/repository/compilers/classroom/exClass-5.zip|exClass-5.zip]]
 +  * **Practice 6**: [[https://www.skenz.it/repository/compilers/classroom/practice6_1.pdf|practice6_1.pdf]], [[https://www.skenz.it/repository/compilers/classroom/practice6_2.pdf|practice6_2.pdf]], [[https://www.skenz.it/repository/compilers/classroom/practice6_6.pdf|practice6_6.pdf]]\\ Type-checking and exam solution\\ Commented exam: [[https://www.skenz.it/repository/compilers/exams/exam1.pdf|Exam 1]].\\ **Solution:** [[https://www.skenz.it/repository/compilers/exercises/sol_exam1.zip|sol_exam1]]
 +  * **Practice 7**: [[https://www.skenz.it/repository/compilers/exams/exam2.pdf|exam2.pdf]], [[https://www.skenz.it/repository/compilers/exams/20150903.pdf|20150903.pdf]]\\ Exams commented in classroom\\ **Solutions:** Exam2: [[https://www.skenz.it/repository/compilers/exercises/sol20060207-1.zip|sol1]], [[https://www.skenz.it/repository/compilers/exercises/sol20060207-2.zip|sol2]], [[https://www.skenz.it/repository/compilers/exercises/sol20060207-3.zip|sol3]] 
 +  * **Other material:**\\ Commented solution of 20150903.pdf exam: [[https://www.skenz.it/compilers/exam_20150903|IMP: exam_20150903]]
 +
 +
 +
 +===== Laboratories =====
 +
 +  * **Laboratory 1:** [[https://www.skenz.it/repository/compilers/laboratory/laboratory_1.pdf|laboratory_1.pdf]]\\ Regular expression and the scanner JFlex\\ Before starting try to compile and to understand the following example: [[https://www.skenz.it/repository/compilers/classroom/exClass-1.zip|exClass-1.zip]]\\ **Solutions:** [[https://www.skenz.it/repository/compilers/exercises/ex1-1.zip|Exercise 1]], [[https://www.skenz.it/repository/compilers/exercises/ex1-2.zip|Exercise 2]], [[https://www.skenz.it/repository/compilers/exercises/ex1-3.zip|Exercise 3]]
 +  * **Laboratory 2:** [[https://www.skenz.it/repository/compilers/laboratory/laboratory_2.pdf|laboratory_2.pdf]]\\ Exercises regarding the JFlex scanner.\\ **Solutions:** [[https://www.skenz.it/repository/compilers/exercises/ex2-1.zip|Exercise 1]], [[https://www.skenz.it/repository/compilers/exercises/ex2-2.zip|Exercise 2]]
 +  * **Laboratory 3:** [[https://www.skenz.it/repository/compilers/laboratory/laboratory_3.pdf|laboratory_3.pdf]]\\ Implement a parser for a simplified version of the C programming language (mini C), and a parser for all the C programming language\\ **Provided code:** for the first exercise the scanner, the main file, the makefile and part of the parser are provided: [[https://www.skenz.it/repository/compilers/exercises/es3_before/compiler_es3_before.zip|compiler_es3_before.zip]]\\ **Solutions:** [[https://www.skenz.it/repository/compilers/exercises/ex3-1.zip|Exercise 1]], [[https://www.skenz.it/repository/compilers/exercises/ex3-2.zip|Exercise 2]], [[https://www.skenz.it/repository/compilers/exercises/ex3-3.zip|Exercise 3]]
 +  * **Laboratory 4:** [[https://www.skenz.it/repository/compilers/laboratory/laboratory_4.pdf|laboratory_4.pdf]]\\ Parsing of a logic program and error handling for the mini C programming language.\\ **Solutions:** [[https://www.skenz.it/repository/compilers/exercises/ex4-1.zip|Exercise 1]], [[https://www.skenz.it/repository/compilers/exercises/ex4-2.zip|Exercise 2]]
 +  * **Laboratory 5:** [[https://www.skenz.it/repository/compilers/laboratory/laboratory_5.pdf|laboratory_5.pdf]]\\ Simple calculator.\\ An example regarding synthesized attributes: [[https://www.skenz.it/repository/compilers/classroom/exClass-4b.zip|exClass-4b.zip]]\\ **Solutions:** [[https://www.skenz.it/repository/compilers/exercises/ex5.zip|Exercise 1]]
 +  * **Laboratory 6:** [[https://www.skenz.it/repository/compilers/laboratory/laboratory_6.pdf|laboratory_6.pdf]]\\ Realize a translator from **mini C** to **Pseudo Assembler**.\\ Description of the Pseudo Assembler language: [[https://www.skenz.it/repository/compilers/interpreter/interpreter.pdf|interpreter.pdf]]\\ Download the interpreter: [[https://www.skenz.it/repository/compilers/interpreter/interpreter.jar|interpreter.jar]]\\ To solve the exercise start from the solution of the second exercise of laboratory 4: [[https://www.skenz.it/repository/compilers/exercises/ex4-2.zip|Exercise 2]]\\ **Solutions:** [[https://www.skenz.it/repository/compilers/exercises/ex6.zip|Exercise 1]]
 +  * **Laboratory 7:** [[https://www.skenz.it/repository/compilers/laboratory/laboratory_7.pdf|laboratory_7.pdf]]\\ Type checking\\ **Solutions:** [[https://www.skenz.it/repository/compilers/exercises/ex7-1.zip|Exercise 1]] [[https://www.skenz.it/repository/compilers/exercises/ex7-2.zip|Exercise 2]]
 +
 +
 +
 +===== Assignments ======
 +Rules and assignments for the 2020/2021 academic year: [[compilers:Assignments20202021]]
 +
 +==== Previous assignments ====
 +  * [[compilers:Flex Bison]]: Implementation of laboratories using the Flex scanner and the Bison parser in C
 +  * [[compilers:Ply]]: Implementation of laboratories using the Flex scanner and the Bison parser in C
 +  * [[compilers:Go to LLVM]]: Translator from the Go language to [[compilers:LLVM]]
 +  * [[compilers:Julia to LLVM]]: Translator from the Julia language to [[compilers:LLVM]]
 +
 +===== Useful Resources =====
 +  * [[compilers:LLVM]]: Guide about the use of LLVM
 +  * **Jflex:** [[https://www.jflex.de|Official Jflex Website]], [[https://www.jflex.de/manual.pdf|Official Jflex Manual]], [[https://www.jflex.de/docu.html|Official Jflex Documentation]]
 +  * **CUP:** [[http://www2.cs.tum.edu/projects/cup/|Official CUP Website]], [[http://www2.cs.tum.edu/projects/cup/docs.php|Official CUP Documentation]]
 +
 +===== Pseudo Assembler interpreter =====
 +  * Description of the Pseudo Assembler language: [[https://www.skenz.it/repository/compilers/interpreter/interpreter.pdf|interpreter.pdf]]
 +  * Interpreter, jar version: [[https://www.skenz.it/repository/compilers/interpreter/interpreter.jar|interpreter.jar]]\\ To run the interpreter: ''java -jar interpreter.jar <filename>''
 +  * Interpreter source code: [[https://www.skenz.it/repository/compilers/interpreter/interpreter.zip|interpreter.zip]]
 +
 +===== Exams =====
 +  * Some previous exams [[https://www.skenz.it/repository/compilers/exams/20200720.pdf|20200720.pdf]],[[https://www.skenz.it/repository/compilers/exams/20150903.pdf|20150903.pdf]],[[https://www.skenz.it/repository/compilers/exams/20120626.pdf|20120626.pdf]],[[https://www.skenz.it/repository/compilers/exams/20090909.pdf|20090909.pdf]], [[https://www.skenz.it/repository/compilers/exams/20081110.pdf|20081110.pdf]], [[https://www.skenz.it/repository/compilers/exams/20080912.pdf|20080912.pdf]], [[https://www.skenz.it/repository/compilers/exams/20080625.pdf|20080625.pdf]], [[https://www.skenz.it/repository/compilers/exams/20061107.pdf|20061107.pdf]]
 +
 +===== Proposed Theses (Master Degree) =====
 +<html>
 +<iframe width="280" height="157" src="https://www.youtube.com/embed/6sLmcXQcWMc" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
 +</html>
 +
 +Thesis proposals can be downloaded here: [[https://www.skenz.it/ss/theses]]\\ **If interested**, for informations, contact: stefano.scanzio [ AT_SYMBOL ] polito.it  (tel. 011 090 5438)  www: [[https://www.skenz.it/ss]]

If you found any error, or if you want to partecipate to the editing of this wiki, please contact: admin [at] skenz.it

You can reuse, distribute or modify the content of this page, but you must cite in any document (or webpage) this url: https://www.skenz.it/compilers?rev=1591866815&do=diff

Privacy Policy