|
|
— |
compilers:ply_examples [2020/11/26 23:18] (current) |
| ====== Ply Examples ====== |
| ===== Introduction ===== |
| In the following page you will find some utilities to let you understand better the PLY parser and its mechanisms. |
| You'll find: |
| |
| - some introductory examples to familiarize yourself with the ply lexer and parser modules. |
| - all the laboratories treated during the course |
| - the solution of three different exams with the PLY parser |
| |
| You can download all the material in the current page from the following link: [[https://www.skenz.it/repository/compilers/ply/ply.zip|PLY MATERIAL]] |
| ===== Introductory Examples ===== |
| * **Lexer Usage:** \\ **Example:** [[https://www.skenz.it/repository/compilers/ply/Practices/Lexer.zip|Lexer]] |
| * **Parser Usage:** \\ **Example:** [[https://www.skenz.it/repository/compilers/ply/Practices/Parser.zip|Parser]] |
| * **Synthetized Attributes Usage:** \\ **Example:** [[https://www.skenz.it/repository/compilers/ply/Practices/Synthetized_Attributes.zip|Synthetized Attributes]] |
| * **Inherited Attributes Usage:** \\ **Example:** [[https://www.skenz.it/repository/compilers/ply/Practices/Inherited_Attributes.zip|Inherited Attributes]] |
| ===== Laboratories ===== |
| * **Laboratory 1:** [[https://www.skenz.it/repository/compilers/ply/Laboratories/Lab1/laboratory_1.pdf|laboratory_1.pdf]]\\ Regular expression and the scanner JFlex\\ **Solutions:** [[https://www.skenz.it/repository/compilers/ply/Laboratories/Lab1/Lab1_ex1.zip|Lab1_ex1]], [[https://www.skenz.it/repository/compilers/ply/Laboratories/Lab1/Lab1_ex2.zip|Lab1_ex2]], [[https://www.skenz.it/repository/compilers/ply/Laboratories/Lab1/Lab1_ex3.zip|Lab1_ex3]] |
| * **Laboratory 2:** [[https://www.skenz.it/repository/compilers/ply/Laboratories/Lab2/laboratory_2.pdf|laboratory_2.pdf]]\\ Exercises regarding the JFlex scanner.\\ **Solutions:** [[https://www.skenz.it/repository/compilers/ply/Laboratories/Lab2/Lab2_ex1.zip|Lab2_ex1]], [[https://www.skenz.it/repository/compilers/ply/Laboratories/Lab2/Lab2_ex2.zip|Lab2_ex2]] |
| * **Laboratory 3:** [[https://www.skenz.it/repository/compilers/ply/Laboratories/Lab3/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\\ **Solutions:** [[https://www.skenz.it/repository/compilers/ply/Laboratories/Lab3/Lab3_ex1.zip|Lab3_ex1]], [[https://www.skenz.it/repository/compilers/ply/Laboratories/Lab3/Lab3_ex2.zip|Lab3_ex2]], [[https://www.skenz.it/repository/compilers/ply/Laboratories/Lab3/Lab3_ex3.zip|Lab3_ex3]] |
| * **Laboratory 4:** [[https://www.skenz.it/repository/compilers/ply/Laboratories/Lab4/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/ply/Laboratories/Lab4/Lab4_ex1.zip|Lab4_ex1]], [[https://www.skenz.it/repository/compilers/ply/Laboratories/Lab4/Lab4_ex2.zip|Lab4_ex2]] |
| * **Laboratory 5:** [[https://www.skenz.it/repository/compilers/ply/Laboratories/Lab5/laboratory_5.pdf|laboratory_5.pdf]]\\ Simple calculator. \\ **Solutions:** [[https://www.skenz.it/repository/compilers/ply/Laboratories/Lab5/Lab5_ex1.zip|Lab5_ex1]] |
| |
| |
| ===== Exams ===== |
| * **Exam 1:** [[https://www.skenz.it/repository/compilers/ply/Exams/Exam1/exam1.pdf|exam1.pdf]]\\ **Solution:** [[https://www.skenz.it/repository/compilers/ply/Exams/Exam1.zip|Exam1]] |
| * **Exam 2:** [[https://www.skenz.it/repository/compilers/ply/Exams/Exam2/exam2.pdf|exam2.pdf]]\\ 3 different solutions for the exam provided.\\ **Solutions:** [[https://www.skenz.it/repository/compilers/ply/Exams/Exam2/Exam2_sol1.zip|Exam2_sol1]], [[https://www.skenz.it/repository/compilers/ply/Exams/Exam2/Exam2_sol2.zip|Exam2_sol2]], [[https://www.skenz.it/repository/compilers/ply/Exams/Exam2/Exam2_sol3.zip|Exam2_sol3]] |
| * **Exam 3:** [[https://www.skenz.it/repository/compilers/ply/Exams/Exam3/exam3.pdf|exam3.pdf]]\\ **Solution:** [[https://www.skenz.it/repository/compilers/ply/Exams/Exam3.zip|Exam3]] |