{"id":13590540,"url":"https://github.com/baziotis/dicc","last_synced_at":"2026-01-18T02:31:28.354Z","repository":{"id":80413979,"uuid":"150874952","full_name":"baziotis/dicc","owner":"baziotis","description":"A compiler for a subset of C written in C.","archived":false,"fork":false,"pushed_at":"2018-12-24T18:23:03.000Z","size":387,"stargazers_count":15,"open_issues_count":0,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2024-11-06T10:46:12.507Z","etag":null,"topics":["c","code-generator","compiler","lexer","parser","x86"],"latest_commit_sha":null,"homepage":null,"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/baziotis.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-09-29T15:00:42.000Z","updated_at":"2024-07-21T15:24:23.000Z","dependencies_parsed_at":"2023-06-07T13:30:21.440Z","dependency_job_id":null,"html_url":"https://github.com/baziotis/dicc","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/baziotis%2Fdicc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baziotis%2Fdicc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baziotis%2Fdicc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baziotis%2Fdicc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/baziotis","download_url":"https://codeload.github.com/baziotis/dicc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247851592,"owners_count":21006781,"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","code-generator","compiler","lexer","parser","x86"],"created_at":"2024-08-01T16:00:47.368Z","updated_at":"2026-01-18T02:31:28.344Z","avatar_url":"https://github.com/baziotis.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"# dicc\nA compiler for a subset of C written in C. \u003cbr/\u003e\nThis is a C to x86_64 assembly compiler. \u003cbr/\u003e\nIt is structured as a standard 3-phase compiler. That means, it has a very simple lexer, and RD (recursive-descent) parser\nand code generator for x86_64. \u003cbr/\u003e\nThanks to [GeorgeLs](https://github.com/georgeLs) for his contribution to the project.\n\n## Usage\nTo use the compiler, you first have to compile it. You can use the compile.sh script for that. This will create\nthe compiler executable 'dicc'. \u003cbr/\u003e\nTo compile a program using dicc, run it and pass as command line argument its file name, like: ./dicc [name].c \u003cbr/\u003e\nExample: __./dicc test.c__ \u003cbr/\u003e\nThis will create an x86_64 [name].s assembly file. To create an executable out of that, you just use some assembler, like gcc:\n__gcc [name].s__ \u003cbr/\u003e \u003cbr/\u003e\nI also have included a test.sh script for ease of use with some test file named test.c\n\n## Compiler features\nCurrently, it supports:\n\n* integers (no other types yet)\n* logical NOT (`!a`)\n* bitwise NOT (`~a`)\n* logical AND (`a \u0026\u0026 b`)\n* logical OR (`a || b`)\n* addition, subtraction, multiplication, division (`+`, `-`, `*`, `/`)\n* comparison operators (`\u003c`,`\u003c=`,`\u003e`,`\u003e=`,`==`)\n* Any binary expression that combines any of the above expressions.\n* C89 style comments (`/* ... */`)\n* Only one function, main\n* return statement\n* custom print statement (not in any C standard)\n* if/else statements (`if (exp) { stat1; stat2; ... } else { stat11; stat12; ... }`)\n* local variables:\n    It has function scope only and declare anywhere, but not block scope yet.\n* while loops (`while (exp) { stat1; stat2; ... }`) whith `break` and `continue`\n* Possibly other things that I forget...\n\nGenerally, the initial target feature set was one, so that the compiler could compile any assignment 1 from\nthe course Introduction to Programming: http://cgi.di.uoa.gr/~ip/ \u003cbr/\u003e\nThere are still some things missing. The main one is preprocessor support and also some not-so-important features\n(like support for all loop types or else if statements). However, it seems that you can compile any assigment 1 source code\nwith little modification.\n\n## Educational features\nThe main goal of this project is to make a descent C compiler written in C, totally from scratch.\nCurrently, apart from the heavy commenting, the compiler tries to put a clear boundary between each phase of compilation.\nAt first, the lexer is run, and outputs its results. Its output is then passed to the parser whose contents are also shown.\nFinally, code generator takes the output from the parser as input and spits out assembly.\nFeel free to ask explanation for any part of the code.\n\n## Reliability and possible improvements\nAlthough the compiler has been tested somewhat, it's still far from adequately stable and reliable and it's definetely\nnot supposed to be used in production.\nFor any suggestions, please contact me.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaziotis%2Fdicc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbaziotis%2Fdicc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaziotis%2Fdicc/lists"}