{"id":16312440,"url":"https://github.com/kiranandcode/pathetic","last_synced_at":"2025-04-22T11:53:27.157Z","repository":{"id":112326632,"uuid":"134628531","full_name":"kiranandcode/pathetiC","owner":"kiranandcode","description":"It was all a MIPStake.","archived":false,"fork":false,"pushed_at":"2018-05-23T21:43:36.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-16T14:25:07.043Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Processing","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/kiranandcode.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":"2018-05-23T21:42:52.000Z","updated_at":"2019-10-14T10:53:21.000Z","dependencies_parsed_at":"2023-05-12T23:30:17.082Z","dependency_job_id":null,"html_url":"https://github.com/kiranandcode/pathetiC","commit_stats":null,"previous_names":["kiranandcode/pathetic"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiranandcode%2FpathetiC","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiranandcode%2FpathetiC/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiranandcode%2FpathetiC/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiranandcode%2FpathetiC/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kiranandcode","download_url":"https://codeload.github.com/kiranandcode/pathetiC/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250237800,"owners_count":21397399,"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":[],"created_at":"2024-10-10T21:48:05.958Z","updated_at":"2025-04-22T11:53:27.137Z","avatar_url":"https://github.com/kiranandcode.png","language":"Processing","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pathetiC\n## It was all a MIPStake.\n\nJust a simple little compiler for a \"pathetic\" subset of C (not even turing complete) - outputs MIPS assembly.\n\nThe language supports while, for ifs and and most basic operations. There is only one type - int. \n\nThe language is almost turing complete, it's equivalent to a linear bounded automata, but lacks arrays so whoops.\n\nUses Three address code internally to represent the input source code.\n\n\n## Example run\nConsider the following program to calculate fibonnaci numbers:\n```\nint i = 0; \nint j = 0;\nint k = 1;\n\nwhile(i \u003c 10) {\n\tint t = j + k;\n\tj = k;\n\tk = t;\n}\n```\n\nOnce parsed, produces the following three address code:\n```\ni = 0\nj = 0\nk = 1\nlabel flag0:\n\tt0 = i LE 10\n\tfjump t0 flag1\n\tt1 = j ADD k\n\tt = t1\n\tj = k\n\tk = t\n\tjump flag0\nlabel flag1:\n```\n\nWhich is then converted into the following mips code:\n```\nli $t0, 0\nli $t1, 0\nli $t2, 1\nflag0:\n\tslt $t3, $t0, 10\n\tbeq $t3, 0, flag1\n\tbeq $t0, 10, flag1\n\tadd $t4, $t1, $t2\n\tli $t1, $t2\n\tli $t2, $t4\n\tj flag0\nflag1:\n```\n\n\n## Uses\n\nSo what on earth could this be used for?\nNothing. It's a toy project. \nJk, it should have at least some utility, right?.\n\n - Well, it does provide a nice small AST perfect for use in building code generation related machine learning experiments.\n - Potentially could provide a nice spring board for trying out super optimization.\n\nBut, at the moment, it's really buggy, so it's not that useful.\n\n\n## AST\n\nThe AST for the program is as follows:\n```\n  program ::= statement program \n\t|\n  statement ::= INT ID = expression ;\n              | expression ;\n              | FOR ( INT ID = expression ; condExpr ; expression ) body\n              | WHILE ( condExpr ) body\n              | IF ( condExpr ) body conditionalControl\n              | Break ;\n  conditionalControl ::= ^\n                       | ELSE body\n                       | ELIF ( condExpr ) body conditionalControl\n\n  body ::= { statementlist }\n  inplaceAssign ::= += | *= | -= | = \n  baseValue ::= ID baseValueEnd | NUMBER baseValueEnd | ( expression ) baseValueEnd | - baseValue baseValueEnd | -- baseValue | ++ baseValue\n  baseValueEnd = inplaceAssign baseValue baseValueEnd\n      | ++\n      | --\n      | \n  factor ::= baseValue factorEnd\n  factorEnd ::= * baseValue factorEnd\n              | / baseValue factorEnd\n              | ^\n  term ::= factor termEnd\n  termEnd ::= + factor termEnd\n            | - factor termEnd\n            | \u003c\u003c factor termEnd\n            | \u003e\u003e factor termEnd\n            | ^\n  condExpr ::= term condExprEnd\n  condExprEnd ::= \u0026\u0026 term condExprEnd\n                | || term condExprEnd\n                | \u003c term condExprEnd\n                | \u003e term condExprEnd\n                | \u003e= term condExprEnd\n                | \u003c= term condExprEnd\n                | ^\n   expression ::= condExpr\n \n```\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkiranandcode%2Fpathetic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkiranandcode%2Fpathetic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkiranandcode%2Fpathetic/lists"}