Need help with HQ9?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

Global Rank
#39,741
Topics of expertise
onion
tor-net...
quine
web-bro...
google-...
anonymi...
zsh-pro...
c89
Location
New York
2 Stars 1 Forks Other 271 Commits 1 Opened issues

Description

🍋 an interpreter of the HQ9+ programming language, written in C++20

Services available

!
?

Need anything else?

Contributors list

# 39,741
gmail
Swift
cpluspl...
swiftui...
182 commits
# 2,352
steam
laravel...
laravel...
advent-...
38 commits
# 84
netlify
TypeScr...
GraphQL
angular...
36 commits
# 99,614
algolia...
cpluspl...
Dart
whatsap...
1 commit

HQ9+

CodeFactor Gitpod: ready to code Run on Repl.it Google: ready to build Codeac C++ CI Super-Linter CodeQL analysis DeepCode GPLP

This is an interpreter of the entire HQ9+ programming language, implemented in C++20. The output of 

9
is Rosetta Stone-compliant and takes a balanced approach to the recursion-versus-readability problem.

Build

This interpreter can be built and tested with almost any C++ compiler built since the 2010s. Testing beyond compilation was completed using Clang 12.0.0 on macOS 11.0 beta and GCC 8.3.0 on Alpine Linux 3.10.0 on iSH 1.0 (73) on iOS 14.0 beta.

  1. Open a terminal and get the code
git clone --verbose --recurse-submodules --progress \
  --branch main https://github.com/LucasLarson/HQ9
  1. move to the newly downloaded content
cd HQ9 || return 1
  1. build the executable for your machine
clang++ -std=c++2a --verbose -v -Wall -Wextra -pedantic -g -lm -lstdc++ -O0 \
  -fcaret-diagnostics -fdiagnostics-fixit-info -fdiagnostics-parseable-fixits \
  -fdiagnostics-print-source-range-info -fdiagnostics-show-option -fident \
  -fno-builtin -fshow-column -fshow-source-location -fstandalone-debug \
  -ftime-report -ftrapv -integrated-as -pthread -save-stats -save-temps \
  $(find * -iname '*\.cpp') -o HQ9+ || ./bootstrap.sh
  1. run the executable
./HQ9+
  1. try any combination of input specified in the language. My favorite’s 
    9
    :
9

Background

HQ9+ is a programming language written by Cliff L. Biffle in the early 2000s. <!-- oldest extant copy of the specification: web.archive.org/web/20010511232301id_/cliff.biffle.org/esoterica/hq9plus.html -->

C

C, written by Dennis Ritchie and Ken Thompson in the mid‑1900s, is the more popular successor to the B programming language.

C89

C89 is the functional equivalent of ANSI C and was published in the late 1900s. In 2020, v0.3.1 of this HQ9+ interpreter was published in C89.

C89.5

There has long been an excellent public radio station in Seattle broadcasting at 89½ MHz. In spoken vernacular, it, too, is often referred to as C89. Please support their important work.

C++

C++ is a grandchild language of the B programming language and a superset of its parent language, C.

C++20

The release of the version of the C++ programming language whose features were finalized just prior to a pandemic, but which at release time, had still not been incorporated into an ISO standard. In 2020, v1.0.0 of this HQ9+ interpreter was published in C++20.


Implementation

Where a specification omits implementation details â€“ where a language’s behavior is undefined â€“ it is the interpreter’s right or responsibility to map conditions to specific behavior where agnosticism fails. That is, unspecified conditions must result in implementation-defined behavior.

For example, the HQ9+ specification implies the machine running it has infinite memory and that the length of input itself have asymptotic similarity to infinity. The devices on which this interpreter was tested had unclear limits, but in all cases, those limits were unambiguously finite, as are the lengths of primitive variable types in C and C++.

Similarly, the specification does not detail how the accumulator’s value is accessed after its initialization at 

0
. In an abundance of caution, and without drawing conclusions, this implementation is responsive to the ambiguity by tracking the accumulator’s value, but preventing accession to it. Further research must verify whether this is a safer alternative than writing to 
/dev/null
, which may raise concerns about data loss.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.