{"id":25306547,"url":"https://github.com/orcalinux/tiny-language-compiler","last_synced_at":"2025-04-07T06:20:30.498Z","repository":{"id":264382820,"uuid":"880999982","full_name":"orcalinux/tiny-language-compiler","owner":"orcalinux","description":"A compiler for a simple programming language with lexical analysis, parsing, and a user-friendly interface. Ideal for learning how compilers are built.","archived":false,"fork":false,"pushed_at":"2025-01-17T14:03:21.000Z","size":74194,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-13T10:36:10.673Z","etag":null,"topics":["compiler-design","parser","scanner","tiny-language"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/orcalinux.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-30T18:36:08.000Z","updated_at":"2025-01-17T14:03:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"47ea6621-9211-4757-80cc-1eb808f93787","html_url":"https://github.com/orcalinux/tiny-language-compiler","commit_stats":null,"previous_names":["orcalinux/design-of-compilers"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orcalinux%2Ftiny-language-compiler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orcalinux%2Ftiny-language-compiler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orcalinux%2Ftiny-language-compiler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orcalinux%2Ftiny-language-compiler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/orcalinux","download_url":"https://codeload.github.com/orcalinux/tiny-language-compiler/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247601446,"owners_count":20964866,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compiler-design","parser","scanner","tiny-language"],"created_at":"2025-02-13T10:30:48.303Z","updated_at":"2025-04-07T06:20:30.476Z","avatar_url":"https://github.com/orcalinux.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tiny Language Compiler\n\n![License](https://img.shields.io/badge/license-MIT-blue.svg) ![CPP](https://img.shields.io/badge/language-CPP-brightgreen.svg) ![SDL2](https://img.shields.io/badge/Qt6-yes-blue.svg)\n\n\n## Table of Contents\n\n- [Overview](#overview)\n- [Features](#features)\n- [Directory Structure](#directory-structure)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Documentation](#documentation)\n- [Testing](#testing)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Overview\n\nThe **Tiny Language Compiler** is a comprehensive project designed to demonstrate the principles and practices of compiler construction for a simplified programming language. This project encompasses all major components of a compiler, including lexical analysis (scanner), parsing, and a graphical user interface (GUI) for interacting with the compiler. It serves as an educational tool for understanding compiler design and implementation.\n\n## Features\n\n- **Lexical Analysis (Scanner):** Tokenizes the source code into meaningful symbols.\n- **Parsing:** Analyzes the token stream to construct a parse tree based on the Tiny Language grammar.\n- **Graphical User Interface (GUI):** Provides an intuitive interface to input code, view tokens, parse trees, and syntax trees.\n- **Comprehensive Documentation:** Includes detailed PDFs on compiler construction and project-specific documentation.\n- **Testing Suite:** Ensures the reliability and correctness of the scanner and parser components.\n- **Extensible Design:** Modular architecture allows for easy extension and modification of language features.\n\n## Directory Structure\n\n```\n.\n├── docs\n│   ├── compiler-construction-principles-and-practice.pdf\n│   ├── compilers-principles-techniques-and-tools.pdf\n│   ├── crafting-interpreters-compress.pdf\n│   ├── keith-cooper-linda-torczon-engineering-a-compiler-en.pdf\n│   └── modern-compiler-implementation-in-c.pdf\n├── LICENSE\n├── parser\n│   ├── include\n│   │   ├── parser.hpp\n│   │   ├── parsing_table.hpp\n│   │   ├── stack.hpp\n│   │   └── token.hpp\n│   ├── Makefile\n│   ├── README.md\n│   ├── src\n│   │   ├── main.cpp\n│   │   ├── parser.cpp\n│   │   ├── parsing_table.cpp\n│   │   ├── stack.cpp\n│   │   └── token.cpp\n│   └── tests\n├── parser_gui\n│   ├── CMakeLists.txt\n│   ├── Data\n│   │   ├── include\n│   │   │   ├── Node.h\n│   │   │   └── Token.h\n│   │   └── src\n│   │       ├── Node.cpp\n│   │       └── Token.cpp\n│   ├── FileHandling\n│   │   ├── include\n│   │   │   └── FileHandler.h\n│   │   └── src\n│   │       └── FileHandler.cpp\n│   ├── main.cpp\n│   ├── MainWindow.cpp\n│   ├── MainWindow.h\n│   ├── Parser\n│   │   ├── include\n│   │   │   └── Parser.h\n│   │   └── src\n│   │       └── Parser.cpp\n│   ├── resources\n│   │   ├── About.png\n│   │   ├── Copy.png\n│   │   ├── Cut.png\n│   │   ├── Help.png\n│   │   ├── New Text File.png\n│   │   ├── New Tokens File.png\n│   │   ├── Open File.png\n│   │   ├── Paste.png\n│   │   ├── Save As File.png\n│   │   ├── Save File.png\n│   │   ├── View Parse Tree.png\n│   │   ├── View Syntax Tree.png\n│   │   ├── View Text.png\n│   │   └── View Tokens.png\n│   ├── resources.qrc\n│   ├── Scanner\n│   │   ├── include\n│   │   │   ├── Scanner.h\n│   │   │   └── TokenStreamBuilder.h\n│   │   └── src\n│   │       ├── Scanner.cpp\n│   │       └── TokenStreamBuilder.cpp\n│   └── Widgets\n│       ├── include\n│       │   ├── TabContent.h\n│       │   ├── TabWidget.h\n│       │   ├── TextEditor.h\n│       │   ├── ToolBar.h\n│       │   └── TreeVisualiser.h\n│       └── src\n│           ├── TabContent.cpp\n│           ├── TabWidget.cpp\n│           ├── TextEditor.cpp\n│           ├── ToolBar.cpp\n│           └── TreeVisualiser.cpp\n├── README.md\n└── scanner\n    ├── build.bat\n    ├── docs\n    │   ├── flex__bison.pdf\n    │   └── ScannerProjectDescription_2024.pdf\n    ├── examples\n    │   ├── example1.txt\n    │   ├── example2.txt\n    │   ├── example3.txt\n    │   ├── example4.txt\n    │   └── example5.txt\n    ├── include\n    │   ├── app.hpp\n    │   ├── file_handler.hpp\n    │   ├── scanner.hpp\n    │   ├── token.hpp\n    │   └── token_stream_builder.hpp\n    ├── Makefile\n    ├── output\n    │   └── output.txt\n    ├── README.md\n    ├── src\n    │   ├── app.cpp\n    │   ├── file_handler.cpp\n    │   ├── main.cpp\n    │   ├── scanner.cpp\n    │   ├── token.cpp\n    │   └── token_stream_builder.cpp\n    └── test\n        ├── scanner_test.cpp\n        └── token_test.cpp\n\n30 directories, 83 files\n```\n\n## Installation\n\n### Prerequisites\n\n- **C++ Compiler:** Ensure you have a C++ compiler installed (e.g., GCC, Clang, MSVC).\n- **CMake:** Required for building the GUI component.\n- **Make:** For building the scanner and parser components.\n- **Qt Framework:** Required for the GUI (parser_gui).\n\n### Clone the Repository\n\n```bash\ngit clone https://github.com/orcalinux/tiny-language-compiler.git\ncd tiny-language-compiler\n```\n\n### Build Scanner\n\nThe scanner component is responsible for lexical analysis.\n\n```bash\ncd scanner\nmake\n```\n\n*For Windows users, you can use the provided `build.bat` script:*\n\n```bash\nbuild.bat\n```\n\n### Build Parser\n\nThe parser component handles syntactic analysis.\n\n```bash\ncd ../parser\nmake\n```\n\n### Build GUI\n\nThe GUI provides an interface to interact with the compiler components.\n\n```bash\ncd ../parser_gui\nmkdir build\ncd build\ncmake ..\nmake\n```\n\n*Ensure that the Qt framework is properly installed and configured on your system.*\n\n## Usage\n\n### Scanner\n\nAfter building, you can run the scanner to tokenize your Tiny Language source code.\n\n```bash\n./scanner \u003csource_file\u003e\n```\n\n*Example:*\n\n```bash\n./scanner examples/example1.txt\n```\n\n### Parser\n\nAfter building, run the parser to generate the parse tree from the token stream.\n\n```bash\n./parser \u003ctoken_stream_file\u003e\n```\n\n*Example:*\n\n```bash\n./parser output/output.txt\n```\n\n### GUI\n\nLaunch the GUI to interact with the scanner and parser visually.\n\n```bash\n./parser_gui\n```\n\nThe GUI allows you to:\n\n- Open and edit Tiny Language source files.\n- View tokens generated by the scanner.\n- Visualize the parse tree and syntax tree.\n- Save and manage token and parse tree files.\n\n## Documentation\n\nComprehensive documentation is available in the `docs` directory, including:\n\n- **Compiler Construction Principles and Practice:** An in-depth guide on compiler design.\n- **Compilers: Principles, Techniques, and Tools:** Reference material for compiler construction.\n- **Crafting Interpreters:** Insights into building interpreters, applicable to compiler design.\n- **Engineering a Compiler:** Best practices for compiler engineering.\n- **Modern Compiler Implementation in C:** Practical implementation details.\n\nAdditional project-specific documentation can be found within the `scanner/docs` and `parser/docs` directories.\n\n## Testing\n\nA suite of tests ensures the reliability and correctness of the compiler components.\n\n### Scanner Tests\n\nNavigate to the `scanner` directory and run the tests:\n\n```bash\ncd scanner\nmake test\n```\n\n### Parser Tests\n\nNavigate to the `parser` directory and run the tests:\n\n```bash\ncd ../parser\nmake test\n```\n\n*Ensure that all dependencies are met before running the tests.*\n\n## Contributing\n\nContributions are welcome! To contribute to this project, follow these steps:\n\n1. **Fork the Repository**\n\n   Click the \"Fork\" button at the top-right corner of this page to create your own fork.\n\n2. **Clone Your Fork**\n\n   ```bash\n   git clone https://github.com/orcalinux/tiny-language-compiler.git\n   cd tiny-language-compiler\n   ```\n\n3. **Create a New Branch**\n\n   ```bash\n   git checkout -b feature/YourFeature\n   ```\n\n4. **Commit Your Changes**\n\n   ```bash\n   git commit -m \"Add some feature\"\n   ```\n\n5. **Push to the Branch**\n\n   ```bash\n   git push origin feature/YourFeature\n   ```\n\n6. **Open a Pull Request**\n\n   Go to the original repository and click the \"New Pull Request\" button.\n\n### Code of Conduct\n\nPlease adhere to the [Contributor Covenant Code of Conduct](https://www.contributor-covenant.org/version/2/0/code_of_conduct/) in all your interactions with the project.\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE). You are free to use, modify, and distribute this software as per the terms of the license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forcalinux%2Ftiny-language-compiler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Forcalinux%2Ftiny-language-compiler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forcalinux%2Ftiny-language-compiler/lists"}