{"id":23288716,"url":"https://github.com/grfrederic/uniphiler","last_synced_at":"2026-01-20T12:33:24.544Z","repository":{"id":163429530,"uuid":"310054704","full_name":"grfrederic/uniphiler","owner":"grfrederic","description":"simple compiler written for a university project","archived":false,"fork":false,"pushed_at":"2021-01-20T15:28:56.000Z","size":213,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-06T16:49:27.589Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Prolog","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/grfrederic.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":"2020-11-04T16:16:45.000Z","updated_at":"2025-02-01T15:40:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"de6c19c0-0abd-439c-9c1f-b4298ae8bd3d","html_url":"https://github.com/grfrederic/uniphiler","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/grfrederic/uniphiler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grfrederic%2Funiphiler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grfrederic%2Funiphiler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grfrederic%2Funiphiler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grfrederic%2Funiphiler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grfrederic","download_url":"https://codeload.github.com/grfrederic/uniphiler/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grfrederic%2Funiphiler/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28603392,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T12:01:53.233Z","status":"ssl_error","status_checked_at":"2026-01-20T12:01:46.545Z","response_time":117,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2024-12-20T03:34:24.482Z","updated_at":"2026-01-20T12:33:24.530Z","avatar_url":"https://github.com/grfrederic.png","language":"Prolog","funding_links":[],"categories":[],"sub_categories":[],"readme":"### Uniphiler: the compiler you love!\n\nThis is a compiler written in Prolog using DCG for the language Latte.\n\n\n### Usage\n\n#### Compiling\n\nRunning\n```\n\u003e ./latc path/to/source.lat\n```\nfor correct programs will produce `path/to/source.prelink.ll`, `path/to/source.ll` and `path/to/source.bc`.\n\n#### Show LLVM\n\nRunning\n```\n\u003e ./latc_llvm path/to/source.lat\n```\nfor correct programs will print the _prelink_ LLVM code.\n\n#### Just checking for errors\n\nRunning\n```\n\u003e ./latc_check path/to/source.lat\n```\nwill return \"OK\" for accepted programs and \"ERROR\" with additional errors for all others.\n\n#### Show Latte AST\n\n```\n\u003e ./latc_ast path/to/source.lat\n```\n\n#### Show Latte tokens\n\n```\n\u003e ./latc_tokens path/to/source.lat\n```\n\nThe executables are just wrappers for [swi-prolog](https://www.swi-prolog.org/) running the scripts prolog scripts:\n  * `latc` and `latc_llvm` run `src/compile.prolog`\n  * `latc_check` runs `src/check_latte.prolog`\n  * `latc_ast` runs `src/show_parse.prolog`\n  * `latc_tokens` runs `src/show_tokens.prolog`\n\n\n### Structure\nThe main stages of compilation:\n\n1. Tokenization (`src/tokenize.prolog`)\n2. Building Latte AST (`src/parse.prolog`)\n3. Type derivation and error checks (`src/typing_and_checks.prolog`)\n4. Generating LLVM AST (`src/llvm.prolog`)\n5. Optimization of LLVM AST (`src/llvm_opts.prolog`)\n6. Register numbering and printing LLVM (`src/llvm_print.prolog`)\n\nAdditionally, some helper modules:\n\n  * uniform error handling for all stages of compilation (`src/errors.prolog`)\n  * a _Context_ structure useful for tracking types and register allocations (`src/context.prolog`)\n  * simplification of simple boolean expressions (`src/simplify.prolog`)\n\nSome builtin functions are compiled from C, those can be found in `runtime/lib.c`, and compiled by running `make`.\n\n\n### Optimization\n\n#### Constant / copy propagation\n\nIn order to comply with SSA, the compiler keeps track of all constants and copy\ninstructions, automatically avoiding unnecessary assignments and copies.\n\nExamples: `examples/opts/const*` and `examples/opts/copy*`\n\n\n#### Use of phi for loops and conditionals\n\nInstead of allocating variables, the compiler uses `phi`s to implement\n`if` and `while` statements. It will detect which variables are changing\nto avoid creating unnecessary `phi`s.\nIt will also try to clean up ones discovered to be redundant during optimization.\n\nExamples: `examples/opts/if*` and `examples/opts/while*`\n\n\n#### Global common subexpression optimization\n\nThe compiler will avoid recalculating instructions that don't have side effects.\n\nExamples: `examples/opts/gcse*`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrfrederic%2Funiphiler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrfrederic%2Funiphiler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrfrederic%2Funiphiler/lists"}