|
| 1 | +--- |
| 2 | +title: "GSoC '25 Week 9 Update by Safwan Sayeed" |
| 3 | +excerpt: "Design and Implementation of Compiler for Music Blocks 4" |
| 4 | +category: "DEVELOPER NEWS" |
| 5 | +date: "2025-08-03" |
| 6 | +slug: "2025-08-03-gsoc-25-sa-fw-an-week9" |
| 7 | +author: "@/constants/MarkdownFiles/authors/safwan-sayeed.md" |
| 8 | +tags: "gsoc25,sugarlabs,week9,sa-fw-an" |
| 9 | +image: "assets/Images/GSOC.png" |
| 10 | +--- |
| 11 | + |
| 12 | +<!-- markdownlint-disable --> |
| 13 | + |
| 14 | +# Week 9 Progress Report by Safwan Sayeed |
| 15 | + |
| 16 | +**Project:** Music Blocks 4 Program Engine |
| 17 | +**Mentors:** [Anindya Kundu](https://github.com/meganindya/), [Sumit Srivastava](https://github.com/sum2it) |
| 18 | +**Assisting Mentors:** [Devin Ullibari](https://github.com/pikurasa/), [Walter Bender](https://github.com/walterbender) |
| 19 | +**Reporting Period:** 2025-07-28 - 2025-08-03 |
| 20 | + |
| 21 | +--- |
| 22 | + |
| 23 | +## A Blog-style Retrospective |
| 24 | + |
| 25 | +This week I Designed and Implemented the Compiler. The work involved translating the Abstract Syntax Tree (AST) into Intermediate Representation (IR) instructions, which are essential for executing programs in Music Blocks 4. |
| 26 | + |
| 27 | +--- |
| 28 | + |
| 29 | +## Goals for This Week |
| 30 | + |
| 31 | +- Write a TechSpec for the Compiler, outlining its architecture and components. |
| 32 | +- Implement the Compiler's core functionality, focusing on the translation from AST to IR. |
| 33 | +- Develop the Data Flow Diagram (DFD) for the Compiler to visualize data movement and interactions within the system. |
| 34 | +--- |
| 35 | + |
| 36 | +## This Week's Highlights |
| 37 | + |
| 38 | +- **TechSpec for Compiler:** |
| 39 | + Created a detailed TechSpec document that outlines the architecture and components of the Compiler, including the translation process from AST to IR. |
| 40 | +- **Implementation of Compiler:** |
| 41 | + Successfully implemented the core functionality of the Compiler, focusing on the translation from AST to IR. |
| 42 | + |
| 43 | + |
| 44 | +- **Data Flow Diagram (DFD):** |
| 45 | + Developed a Data Flow Diagram (DFD) to visualize the data movement and interactions within the Compiler system, providing a clear overview of how data flows through the various components. |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | +--- |
| 52 | + |
| 53 | +## Challenges & Solutions |
| 54 | + |
| 55 | +- **Dynamic Variable Management:** |
| 56 | + Encountered challenges in managing dynamic variables and memory allocation during the translation process. To address this, I implemented a robust memory management system that ensures efficient allocation and deallocation of resources. |
| 57 | +- **Complexity of AST to IR Translation:** |
| 58 | + The translation from AST to IR was complex due to the need to maintain the integrity of the original program while optimizing for performance. I tackled this by breaking down the translation process into smaller, manageable components, allowing for easier debugging and testing. |
| 59 | + |
| 60 | + |
| 61 | +--- |
| 62 | + |
| 63 | +## Key Learnings |
| 64 | + |
| 65 | +- Gained a deeper understanding of compiler design principles, particularly in the context of static compilation. |
| 66 | +- Learned about the intricacies of translating an Abstract Syntax Tree (AST) into Intermediate Representation (IR) instructions, including the challenges of maintaining program semantics while optimizing for performance. |
| 67 | +--- |
| 68 | + |
| 69 | +## Next Week's Roadmap |
| 70 | + |
| 71 | +- **Think about the Scheduler:** |
| 72 | + Explore how the Scheduler can be integrated into the Compiler to manage the execution of programs more effectively, including task prioritization and resource allocation. |
| 73 | + |
| 74 | +--- |
| 75 | + |
| 76 | +## Resources & References |
| 77 | + |
| 78 | +- **Repository:** [musicblocks-v4](https://github.com/sugarlabs/musicblocks-v4) |
| 79 | + |
| 80 | +--- |
| 81 | + |
| 82 | +## Acknowledgments |
| 83 | + |
| 84 | +Special thanks to my mentors Anindya, Sumit, Devin, and Walter for their crucial guidance on compiler design principles and static compilation concepts. Their clarification on the AST-to-IR translation approach and emphasis on maintaining clean instruction generation patterns was essential for this week's successful progress. |
| 85 | + |
| 86 | +--- |
0 commit comments