{"id":16130181,"url":"https://github.com/lambdacasserole/tiny-compiler","last_synced_at":"2025-10-03T15:55:26.767Z","repository":{"id":52283294,"uuid":"65099615","full_name":"lambdacasserole/tiny-compiler","owner":"lambdacasserole","description":"Very tiny compiler for a simple arithmetic language. ","archived":false,"fork":false,"pushed_at":"2016-08-11T20:43:37.000Z","size":49,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-02T16:25:34.924Z","etag":null,"topics":["c","compiler","ebnf","grammar","stack-machine"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lambdacasserole.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}},"created_at":"2016-08-06T19:56:08.000Z","updated_at":"2023-03-24T05:38:59.000Z","dependencies_parsed_at":"2022-09-12T10:31:14.240Z","dependency_job_id":null,"html_url":"https://github.com/lambdacasserole/tiny-compiler","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lambdacasserole/tiny-compiler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lambdacasserole%2Ftiny-compiler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lambdacasserole%2Ftiny-compiler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lambdacasserole%2Ftiny-compiler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lambdacasserole%2Ftiny-compiler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lambdacasserole","download_url":"https://codeload.github.com/lambdacasserole/tiny-compiler/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lambdacasserole%2Ftiny-compiler/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267693314,"owners_count":24129131,"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","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","ebnf","grammar","stack-machine"],"created_at":"2024-10-09T22:14:55.587Z","updated_at":"2025-10-03T15:55:21.068Z","avatar_url":"https://github.com/lambdacasserole.png","language":"C","readme":"# Tiny Compiler\nVery tiny compiler for a simple arithmetic language. \n\nThis is a tiny compiler which produces assembler code targeting [a particular very simple stack machine](http://www.staff.science.uu.nl/~dijks106/SSM/) out of an even simpler arithmetic language. Put together for an experiment in compiler verification.\n\n## Building\nBuilds a treat under Windows using the [Tiny C Compiler](http://bellard.org/tcc/) by the one and only [Fabrice Bellard](https://en.wikipedia.org/wiki/Fabrice_Bellard).\n\n```\ntcc tiny.c\n```\n\n## Source Language\nThe source language consists of an arbitrarily deep tree of expressions. An expression may take the form of a number or three-member tuple containing an operator followed by exactly two operands which must each themselves be expressions. In EBNF:\n\n```\ndigit = \"0\" | \"1\" | \"2\" | \"3\" | \"4\" | \"5\" | \"6\" | \"7\" | \"8\" | \"9\".\nnumber = digit { digit }.\noperator = \"add\" | \"sub\" | \"mul\" | \"div\".\nexpression = number | ( \"(\" operator expression expression \")\" ).\n```\n\nThis grammar is written to be compatible with [a piece of visualization software](http://dotnet.jku.at/applications/visualizer/) developed by a team at the University of Linz. To save you downloading it and rendering the grammar, here it is visually:\n\n![Grammar](https://github.com/lambdacasserole/tiny-compiler/raw/master/grammar/grammar.png)\n\n## Target Language\nThe target for this compiler is the [Simple Stack Machine](http://www.staff.science.uu.nl/~dijks106/SSM/). The source code:\n\n```\n(add 1 2)\n```\n\nWill produce the following result:\n\n```\nldc 1\nldc 2\nadd\n```\n\nThis will push two constants onto the stack (using the `ldc` command) and then add them together, pushing the result back on to the stack.\n\n## Limitations\nThis 'compiler' obviously has a few limitations:\n\n* The language obviously isn't a serious development language. \n* Memory currently isn't deallocated before program exit so your OS better do it for you. This may be addressed in future.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flambdacasserole%2Ftiny-compiler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flambdacasserole%2Ftiny-compiler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flambdacasserole%2Ftiny-compiler/lists"}