{"id":15048060,"url":"https://github.com/lucaslarson/hq9","last_synced_at":"2025-04-10T01:11:47.935Z","repository":{"id":37073497,"uuid":"274529532","full_name":"LucasLarson/HQ9","owner":"LucasLarson","description":"🍋  an interpreter of the HQ9+ programming language, written in C++20","archived":false,"fork":false,"pushed_at":"2025-02-23T20:21:15.000Z","size":395,"stargazers_count":4,"open_issues_count":3,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-10T01:11:40.686Z","etag":null,"topics":["99-bottles-of-beer","biffle","c89","c895","c895fm","cplusplus","cplusplus-20","cpp","cpp20","entire-language","hacktoberfest","hello-world","hq9","hq9p","hq9plus","interpreter","lucaslarson","programming-language","quine"],"latest_commit_sha":null,"homepage":"https://git.io/HQ9","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LucasLarson.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.md","contributing":null,"funding":".github/funding.yml","license":"license.adoc","code_of_conduct":".github/code_of_conduct.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/codeowners","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"LucasLarson"}},"created_at":"2020-06-23T23:29:35.000Z","updated_at":"2025-02-23T20:21:18.000Z","dependencies_parsed_at":"2023-02-16T12:00:36.858Z","dependency_job_id":"09163167-5c67-47da-b9a8-01a19682baf5","html_url":"https://github.com/LucasLarson/HQ9","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucasLarson%2FHQ9","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucasLarson%2FHQ9/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucasLarson%2FHQ9/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucasLarson%2FHQ9/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LucasLarson","download_url":"https://codeload.github.com/LucasLarson/HQ9/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248137888,"owners_count":21053775,"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":["99-bottles-of-beer","biffle","c89","c895","c895fm","cplusplus","cplusplus-20","cpp","cpp20","entire-language","hacktoberfest","hello-world","hq9","hq9p","hq9plus","interpreter","lucaslarson","programming-language","quine"],"created_at":"2024-09-24T21:07:32.873Z","updated_at":"2025-04-10T01:11:47.908Z","avatar_url":"https://github.com/LucasLarson.png","language":"C++","funding_links":["https://github.com/sponsors/LucasLarson"],"categories":[],"sub_categories":[],"readme":"# HQ9+\n\n[![CodeFactor](https://www.codefactor.io/repository/github/lucaslarson/hq9/badge)](https://www.codefactor.io/repository/github/lucaslarson/hq9)\n[![Gitpod: ready to code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/LucasLarson/HQ9)\n[![Run on Repl.it](https://web.archive.org/web/0id_/github.com/replit/replit.github.io/raw/8d6b0eaf1c/static/images/repls/run-on-replit.svg)](https://repl.it/github/LucasLarson/HQ9)\n[![Google: ready to build](https://img.shields.io/badge/Google%20Cloud%20Shell-build-5391fe?logo=google-cloud\u0026logoColor=fff)](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/LucasLarson/HQ9)\n[![Codeac](https://static.codeac.io/badges/2-274529532.svg \"Codeac.io\")](https://app.codeac.io/github/LucasLarson/HQ9)\n[![C++ CI](https://github.com/LucasLarson/HQ9/workflows/C++%20CI/badge.svg)](https://github.com/LucasLarson/HQ9/actions?query=workflow:\"C%2B%2B+CI\")\n[![Super-Linter](https://github.com/LucasLarson/HQ9/workflows/Super-Linter/badge.svg)](https://github.com/LucasLarson/HQ9/actions?query=workflow:\"Super-Linter\")\n[![CodeQL analysis](https://github.com/LucasLarson/HQ9/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/LucasLarson/HQ9/actions/workflows/codeql-analysis.yml)\n[![GPLP](https://img.shields.io/badge/license-GPLP-blue \"GNU General Public License for Pedants\")](https://github.com/LucasLarson/HQ9/blob/main/license.adoc)\n\u003c!-- TOC depthFrom:2 depthTo:6 withLinks:1 updateOnSave:1 orderedList:0 --\u003e\n\n- [Build](#build)\n- [Background](#background)\n  - [C](#c)\n    - [C89](#c89)\n      - [C89.5](#c895)\n  - [C++](#c-1)\n    - [C++20](#c20)\n- [Implementation](#implementation)\n\n\u003c!-- /TOC --\u003e\n\nThis is an interpreter of the entire HQ9+ programming language, implemented\nin\u0026nbsp;C++20. The output of\u0026nbsp;`9` is Rosetta\u0026nbsp;Stone-compliant and takes\na balanced approach to the recursion-versus-readability\u0026nbsp;problem.\n\n## Build\n\nThis interpreter can be built and tested with almost any C++ compiler built\nsince the\u0026nbsp;2010s. Testing beyond compilation was completed using\nClang\u0026nbsp;12.0.0 on macOS\u0026nbsp;11.0\u0026nbsp;beta and GCC\u0026nbsp;8.3.0 on\nAlpine\u0026nbsp;Linux\u0026nbsp;3.10.0 on iSH\u0026nbsp;1.0\u0026nbsp;(73) on\niOS\u0026nbsp;14.0\u0026nbsp;beta.\n\n1. Open a terminal and get the\u0026nbsp;code\n\n```shell\ngit clone --verbose --recurse-submodules --progress \\\n  --branch main https://github.com/LucasLarson/HQ9\n```\n\n2. move to the newly downloaded\u0026nbsp;content\n\n```shell\ncd HQ9 || return 1\n```\n\n3. build the executable for your\u0026nbsp;machine\n\n```shell\nclang++ -std=c++2a --verbose -v -Wall -Wextra -pedantic -g -lm -lstdc++ -O0 \\\n  -fcaret-diagnostics -fdiagnostics-fixit-info -fdiagnostics-parseable-fixits \\\n  -fdiagnostics-print-source-range-info -fdiagnostics-show-option -fident \\\n  -fno-builtin -fshow-column -fshow-source-location -fstandalone-debug \\\n  -ftime-report -ftrapv -integrated-as -pthread -save-stats -save-temps \\\n  ./*.cpp -o HQ9+ || ./bootstrap.sh\n```\n\n4. run the\u0026nbsp;executable\n\n```shell\n./HQ9+\n```\n\n5. try any combination of input specified in the\u0026nbsp;language. My\n   favorite’s\u0026nbsp;`9`:\n\n```shell\n9\n```\n\n---\n\n## Background\n\nHQ9+ is a programming language written by Cliff L. Biffle in the\nearly\u0026nbsp;2000s. \u003c!--\noldest extant copy of the specification:\nweb.archive.org/web/20010511232301id_/cliff.biffle.org/esoterica/hq9plus.html\n--\u003e\n\n### C\n\nC, written by Dennis Ritchie and Ken Thompson in the\u0026nbsp;mid‑1900s, is the more\npopular successor to the B\u0026nbsp;programming\u0026nbsp;language.\n\n#### C89\n\nC89 is the functional equivalent of ANSI\u0026nbsp;C and was published in the\nlate\u0026nbsp;1900s. In 2020,\n[v0.3.1 of this HQ9+ interpreter](https://github.com/LucasLarson/HQ9/tree/v0.3.1)\nwas published in\u0026nbsp;C89.\n\n##### C89.5\n\nThere has long been an excellent public radio station in Seattle broadcasting\nat 89½ MHz. In spoken vernacular, it, too, is often referred to as\u0026nbsp;C89.\nPlease [support](https://c895.org/donate) their important\u0026nbsp;work.\n\n### C++\n\nC++ is a grandchild language of the B\u0026nbsp;programming language and a superset\nof its parent language,\u0026nbsp;C.\n\n#### C++20\n\nThe release of the version of the C++ programming language whose features were\nfinalized just prior to a pandemic, but which at release time, had still not\nbeen incorporated into an ISO\u0026nbsp;standard. In 2020,\n[v1.0.0 of this HQ9+ interpreter](https://github.com/LucasLarson/HQ9/tree/v1.0.0)\nwas published in\u0026nbsp;C++20.\n\n---\n\n## Implementation\n\nWhere a specification omits implementation details\u0026nbsp;– where a language’s\nbehavior is undefined\u0026nbsp;– it is the interpreter’s right or responsibility to\nmap conditions to specific behavior where agnosticism\u0026nbsp;fails. That is,\nunspecified conditions must result in implementation-defined\u0026nbsp;behavior.\n\nFor example, the HQ9+ specification implies the machine running it has infinite\nmemory and that the length of input itself have asymptotic similarity\nto\u0026nbsp;infinity. The devices on which this interpreter was tested had unclear\nlimits, but in all cases, those limits were unambiguously finite, as are the\nlengths of primitive variable types in C and\u0026nbsp;C++.\n\nSimilarly, the specification does not detail how the accumulator’s value is\naccessed after its initialization at\u0026nbsp;`0`. In an abundance of caution, and\nwithout drawing conclusions, this implementation is responsive to the ambiguity\nby tracking the accumulator’s value, but preventing accession to\u0026nbsp;it.\nFurther research must verify whether this is a safer alternative than writing\nto\u0026nbsp;`/dev/null`, which may raise concerns about data\u0026nbsp;loss.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucaslarson%2Fhq9","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucaslarson%2Fhq9","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucaslarson%2Fhq9/lists"}