{"id":20047788,"url":"https://github.com/fadel-hasan/python-compiler","last_synced_at":"2025-03-02T08:19:17.672Z","repository":{"id":216680161,"uuid":"742023493","full_name":"fadel-hasan/python-compiler","owner":"fadel-hasan","description":"simple python compiler by using flex\\bison","archived":false,"fork":false,"pushed_at":"2024-01-17T18:10:20.000Z","size":35,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-12T20:30:26.662Z","etag":null,"topics":["bison-flex","bison-parser","compiler","compiler-design","flex-bison","lex","lex-yacc","lexer-parser","lexical-analysis","lexical-analyzer","parser","parsing","python","python-compiler","python-lex-yacc","python-parser","python3","yacc"],"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/fadel-hasan.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-01-11T15:51:17.000Z","updated_at":"2024-01-17T18:10:24.000Z","dependencies_parsed_at":"2024-01-17T20:02:03.308Z","dependency_job_id":null,"html_url":"https://github.com/fadel-hasan/python-compiler","commit_stats":null,"previous_names":["fadel-hasan/python-compiler"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fadel-hasan%2Fpython-compiler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fadel-hasan%2Fpython-compiler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fadel-hasan%2Fpython-compiler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fadel-hasan%2Fpython-compiler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fadel-hasan","download_url":"https://codeload.github.com/fadel-hasan/python-compiler/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241477229,"owners_count":19969077,"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":["bison-flex","bison-parser","compiler","compiler-design","flex-bison","lex","lex-yacc","lexer-parser","lexical-analysis","lexical-analyzer","parser","parsing","python","python-compiler","python-lex-yacc","python-parser","python3","yacc"],"created_at":"2024-11-13T11:38:16.878Z","updated_at":"2025-03-02T08:19:17.638Z","avatar_url":"https://github.com/fadel-hasan.png","language":"C++","readme":"# flex-bison python compiler\n\ncompiler for python made using lex yacc / [GNU's flex bison](https://www.gnu.org/software/bison/manual/).\n\nThe current version of this code supports `defining a function`, `defining a class`, `calling a function`, various types of `expressions`, `assignment` statements, and `if conditions`, in addition to loops such as `for` and `while` and some other structures such as `try`, `match`, `yield`, `global`, `nonlocal`, `return`, `break`, `continue`, `INDENT` \\ `DEDENT` analysis using `stack`\n\n## How to make\n You will need `flex`, `bison`, and `gcc` installed on your machine\n\n\n\n#### To change sh script permission:\n`$ chmod +x build.sh clear.sh`\n\n\n\n#### To build:\n`$ ./build.sh`\n\u003cbr\u003e\n*compiled*: `compiler`, `parser.tab.c`, `parser.tab.h`, `lex.yy.c`\n\n\n\n\n#### To run:\n`$ ./compiler test.py`\n\n\n\n#### To clear:\n`$ ./clear.sh`\n\n\n### Explaining the operating steps without using the build file\n\nThis program is run using the following commands:\n\n```bash\nbison -d parser.y \n```\n- This instruction produces two files:\n  - parser.tab.h : We use this to include it inside the flex file to read the token\n  - parser.tab.c : We use this file to make a compiler with the resulting flex file\n\n```bash\nflex pycompile.l \n```\n- This instruction produces lex.yy.c file: We use this file to make a compiler with the resulting bison file(parser.tab.c)\n\n`Finally`, to compile flex and bixon, we write this command:\n\n```bash\n gcc -o \u003cprogram file name\u003e parser.tab.c lex.yy.c\n```\n- This produces \u003cname\u003e.exe file\n\n`Note` : The `stack` file is included in order to deal with indentation in a file pycompile.l\ntest file is : test py\n\nbut now is ready to execution ^_____^\n\n## Authors\n\n- [@fadel-hasan](https://www.github.com/fadel-hasan)\n\n\n## License\n\n[![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://choosealicense.com/licenses/mit/)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffadel-hasan%2Fpython-compiler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffadel-hasan%2Fpython-compiler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffadel-hasan%2Fpython-compiler/lists"}