{"id":18065098,"url":"https://github.com/rohittp0/not-python","last_synced_at":"2025-04-11T18:11:26.162Z","repository":{"id":64524417,"uuid":"576454878","full_name":"rohittp0/not-python","owner":"rohittp0","description":"!Python is a tiny language that I made to learn how compilers do their magic. The compiler of !Python is written in pure python ( no dependencies )","archived":false,"fork":false,"pushed_at":"2023-11-07T16:21:02.000Z","size":50,"stargazers_count":3,"open_issues_count":1,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-05T09:16:21.214Z","etag":null,"topics":["compiler","language","programming-language","python"],"latest_commit_sha":null,"homepage":"https://rohittp.com/not-python/","language":"Python","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/rohittp0.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}},"created_at":"2022-12-09T22:55:38.000Z","updated_at":"2024-07-01T15:08:41.000Z","dependencies_parsed_at":"2023-11-07T17:33:39.336Z","dependency_job_id":"33cc3d41-cd84-4c5d-b116-b4c934f268e7","html_url":"https://github.com/rohittp0/not-python","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohittp0%2Fnot-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohittp0%2Fnot-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohittp0%2Fnot-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohittp0%2Fnot-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rohittp0","download_url":"https://codeload.github.com/rohittp0/not-python/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248456366,"owners_count":21106603,"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","language","programming-language","python"],"created_at":"2024-10-31T06:09:06.398Z","updated_at":"2025-04-11T18:11:26.143Z","avatar_url":"https://github.com/rohittp0.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# !Python\n\n**!Python** is a tiny language that I made to learn how compilers do their magic. The compiler of **!Python** is written \nin pure python ( no dependencies ). It currently supports limited functionalities only, but in the future I might add more.\nOr if you are interested you can add them, power of open source right !?. \n\n## Setup\n\nTo set up the compiler, you need to have **python** installed on your system. You also need **g++** as the compiler uses it to \ncompile the generated intermediate code.\n\n## How to use\n\n1. Clone the [repository](https://github.com/rohittp0/not-python.git)\n2. Run `python3 main.py \u003cfilename\u003e` to compile the file\n3. Run `\u003cfilename\u003e.exe` to execute the program\n\n## Syntax\n\n**!Python** uses a simple syntax. It is similar to c/c++ but with some differences. The syntax is as follows:\n\n1. Statements should be written one per line\n2. `PRINT \u003cexpression\u003e`: Prints the value of the expression\n3. `INPUT \u003cvariable\u003e`: Takes input from the user and stores it in the variable\n4. `IF \u003cexpression\u003e { \u003cstatement\u003e }`: Executes the statement if the expression is true\n5. `WHILE \u003cexpression\u003e { \u003cstatement\u003e }`: Executes the statement while the expression is true\n6. `LET \u003cvariable\u003e = \u003cexpression\u003e`: Assigns the value of the expression to the variable\n7. `RETURN \u003cexpression\u003e`: Terminates the program with expression as exit code\n8. If multiple expressions are given to the print statement, they are printed in the same line\n\nThat's basically it. You can check the [examples](./examples) folder for more examples.\n\nWhat about comments you ask ? Comments are for those who can't write readable code. Just kidding, I will add comments \nlater.\n\n## Keywords\n\nThe following keywords are reserved in **!Python**:\n\n- PRINT\n- INPUT\n- LET\n- IF\n- WHILE\n- RETURN\n\nAll keywords are case-sensitive, why would you want to write `print` instead of `PRINT` ? 🤷.\n\nThis means it is perfectly legal to do something like this:\n\n    INPUT print\n    PRINT \"You said \" print\n\nBut it is not legal to do something like this:\n\n    INPUT PRINT\n    PRINT \"You said \" PRINT\n\n## Compiler Flags\n\nCurrently, there are only 2 compiler flags:\n\n- `-d`: Enables debug mode. In debug mode, the compiler preserves the intermediate code generated. \nIt will be saved as `\u003cfilename\u003e.exe.cpp`\n- `-o \u003cfilename\u003e`: Specifies the name of the output file. By default, the output file is `\u003cfilename\u003e.exe`\n\n## Examples\n\nYou can check the [examples](./examples) folder for more examples.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frohittp0%2Fnot-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frohittp0%2Fnot-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frohittp0%2Fnot-python/lists"}