{"id":27275219,"url":"https://github.com/gabriel-dp/c2python","last_synced_at":"2026-05-09T10:23:34.366Z","repository":{"id":286677611,"uuid":"959814747","full_name":"gabriel-dp/c2python","owner":"gabriel-dp","description":"Convert your C code to Python. Practical work in the Compilers subject at UFSJ.","archived":false,"fork":false,"pushed_at":"2025-04-07T19:34:19.000Z","size":3,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-07T20:34:21.598Z","etag":null,"topics":["c","compiler","python","ufsj"],"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/gabriel-dp.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":"2025-04-03T11:53:49.000Z","updated_at":"2025-04-07T19:34:22.000Z","dependencies_parsed_at":"2025-04-07T20:36:00.727Z","dependency_job_id":"1e8f8d12-c454-4baf-8610-4c3de513e660","html_url":"https://github.com/gabriel-dp/c2python","commit_stats":null,"previous_names":["gabriel-dp/c2python"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabriel-dp%2Fc2python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabriel-dp%2Fc2python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabriel-dp%2Fc2python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabriel-dp%2Fc2python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gabriel-dp","download_url":"https://codeload.github.com/gabriel-dp/c2python/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248433687,"owners_count":21102640,"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":["c","compiler","python","ufsj"],"created_at":"2025-04-11T15:47:54.106Z","updated_at":"2026-05-09T10:23:34.359Z","avatar_url":"https://github.com/gabriel-dp.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# c2python\n\n\u003e Convert your C code to Python using a C++ program\n\n```cpp\n#define STUDENT \"Gabriel de Paula\"\n#define SUBJECT \"Compiladores\"\n#define PROFESSOR \"Flávio Schiavoni\"\n#define SEMESTER \"2025/1\"\n```\n\n\u0026nbsp;\n\n## How to use\n\nGenerate the executable:\n\n```bash\nmake\n```\n\nRun the executable\n\n```bash\n./bin/compiler \u003csource_file.c\u003e \u003coutput_file.py\u003e\n```\n\n\u0026nbsp;\n\n## Simplified C Syntax\n\n### 1. Identifiers\n\n- Must start with an alphabetic character or an underscore (`_`).\n- Can contain any combination of letters, digits, and underscores after the first character.\n\n### 2. Numbers\n\n- Must start with a digit.\n- Can contain **one** dot `.` to separate the integer and decimal parts.\n- May end with the letter `f` to represent a `float`.\n\n### 3. String Literals\n\n- Must start and end with a double quote `\"`.\n- The sequence `\\\"` is used to escape a double quote within the string.\n\n### 4. Operators\n\n- Supported operators include:  \n  `*`, `/`, `%`, `+`, `-`, `==`, `!=`, `\u0026\u0026`, `||`, `=`, `+=`, `-=`, `*=`, `/=`, `%=`, `\u0026`, `|`, `.`, `\u003e`, `\u003c`, `\u003e=`, `\u003c=`, `!`\n- If an operator consists of multiple characters, each individual character must also be a valid operator on its own.\n\n### 5. Separators\n\n- **Token-generating separators**:  \n  `(`, `)`, `{`, `}`, `[`, `]`, `;`, `,`\n- **Ignored separators (do not generate tokens)**:  \n  whitespace, newline `\\n`, tab `\\t`\n\n### 6. Comments\n\n- Line comments start with `//`\n\n- Block comments start with `/*` and end with `*/`\n\n\u0026nbsp;\n\n## Discussion\n\nThis project was built only for educational purposes, probably will never be finished, but was a great way to learn more about compilers.\n\n- [x] Lexical Analyzer\n- [x] Syntax Analyzer\n- [x] Semantic Analyzer\n- [x] Code Generation (poor)\n- [ ] Optimization\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgabriel-dp%2Fc2python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgabriel-dp%2Fc2python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgabriel-dp%2Fc2python/lists"}