{"id":18884333,"url":"https://github.com/gastonduault/compiler","last_synced_at":"2026-05-05T20:40:05.542Z","repository":{"id":198268803,"uuid":"691929934","full_name":"gastonduault/compiler","owner":"gastonduault","description":"C to assembly language compiler","archived":false,"fork":false,"pushed_at":"2025-02-05T16:42:02.000Z","size":149,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-05T17:41:44.588Z","etag":null,"topics":["assembly","c","compilator","cpp"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gastonduault.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2023-09-15T07:33:36.000Z","updated_at":"2025-02-05T16:42:05.000Z","dependencies_parsed_at":"2024-11-08T07:12:21.398Z","dependency_job_id":"5933f091-247e-403a-991b-475e67622eac","html_url":"https://github.com/gastonduault/compiler","commit_stats":null,"previous_names":["gastonduault/compilateur","gastonduault/compiler"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gastonduault%2Fcompiler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gastonduault%2Fcompiler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gastonduault%2Fcompiler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gastonduault%2Fcompiler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gastonduault","download_url":"https://codeload.github.com/gastonduault/compiler/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239854633,"owners_count":19708129,"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":["assembly","c","compilator","cpp"],"created_at":"2024-11-08T07:12:14.088Z","updated_at":"2026-02-22T18:30:18.523Z","avatar_url":"https://github.com/gastonduault.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# C to Assembly Compiler Repository\n\n## Repository Structure\n```\n📦 C-to-Assembly-Compiler\n├── 📁 src\n│   └── 📁 Analyses         \n│   │    ├── 📄 AnalyseLexicale.cpp      \n│   │    ├── 📄 AnalyseSemantique.cpp    \n│   │    └──  📄 AnalyseSyntaxique.cpp    \n│   └── 📁 Objets     \n│   │    ├── 📄 Noeud.cpp      \n│   │    ├── 📄 Operateur.cpp      \n│   │    ├── 📄 Sybole.cpp      \n│   │    └── 📄 Token.cpp          \n│   └── 📁 Tests     \n│        └── 📄 prog.c   \n├── 📄 compilation.cpp       \n├── 📄 GenCode.cpp    \n├── 📄 Types.cpp    \n└── 📄 README.md              \n```\n\n## Description\nThis repository contains a **compiler** that translates a C program into an **assembly script**. It performs lexical analysis, syntax analysis, semantic analysis, and code generation to produce assembly code from a given C program.\n\n## Features\n- **Lexical Analysis**: Tokenizes the input C source code.\n- **Syntax Analysis**: Checks for syntactical correctness and builds an Abstract Syntax Tree (AST).\n- **Semantic Analysis**: Ensures proper type checking and variable scope handling.\n- **Code Generation**: Converts the AST into assembly code for execution.\n\n## Installation \u0026 Compilation\n### Prerequisites\n- A C++ compiler (e.g., `g++`)\n- Basic knowledge of C and Assembly language\n\n### Compilation\nTo compile the project, run the following command:\n```bash\n    g++ compilation.cpp -o compilation\n```\n\n### Running the Compiler\nTo execute the compiler, make sure to set the correct input file path inside `compilation.cpp`:\n```cpp\nstd::string chemin = \"path/to/your/c_program.c\";\n```\nThen, run the compiled binary:\n```bash\n./compilation\n```\n\n### Input\nThe compiler reads a **C program** from the specified file and processes it.\n\n### Output\nThe generated **assembly code** is printed to the standard output (terminal).\n\n## Example\nA sample C program:\n```c\nint main() {\n    int a = 5;\n    int b = 10;\n    int c = a + b;\n    return c;\n}\n```\nWould be converted into:\n```assembly\n.start\nprep main\ncall 0\nhalt\n.push 5\n.push 10\nadd\nret\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgastonduault%2Fcompiler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgastonduault%2Fcompiler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgastonduault%2Fcompiler/lists"}