hoc: extended high-order calculator

Last update: Fri Dec 27 07:22:37 2002     Fri Sep 24 08:42:55 2004     Thu Nov 4 06:13:29 2004

hoc interprets a simple language for floating-point arithmetic, at about the level of Basic, with C-like syntax and functions. However, unlike Basic, hoc version 7 has particularly rich support for floating-point arithmetic, and its facilities are certainly better than that standardly provided by most programming languages, such as C, C++, and Fortran.

hoc is succinctly described in UNIX manual pages, available in several convenient formats:

This package is available in several functionally-equivalent distribution formats with identical contents: .jar (Java archive), .tar.bz2 (bzip2'ed UNIX tar archive), .tar.gz (gzipped UNIX tar archive), .zip (InfoZip), and .zoo (zoo), together with companion contents listings ending in -lst. Each unpacks into a subdirectory named by the basename of the distribution file, e.g., hoc-7.0.6.beta.

NB: The beta suffix is not because these are unstable releases, but instead, reflect that this is a developing language. Each release has successfully passed a large validation suite on over a dozen flavors of Unix.
hoc-7.0.0.beta [.1, .html, .info, .jar, .jar-lst, .tar.bz2, .tar.gz, .tar-lst, .texi, .zip, .zip-lst, .zoo, .zoo-lst]
hoc-7.0.1.beta [.1, .html, .info, .jar, .jar-lst, .tar.bz2, .tar.gz, .tar-lst, .texi, .zip, .zip-lst, .zoo, .zoo-lst]
hoc-7.0.2.beta [.1, .html, .info, .jar, .jar-lst, .tar.bz2, .tar.gz, .tar-lst, .texi, .zip, .zip-lst, .zoo, .zoo-lst]
hoc-7.0.3.beta [.1, .html, .info, .jar, .jar-lst, .tar.bz2, .tar.gz, .tar-lst, .texi, .zip, .zip-lst, .zoo, .zoo-lst]
hoc-7.0.4.beta [.1, .html, .info, .jar, .jar-lst, .tar.bz2, .tar.gz, .tar-lst, .texi, .zip, .zip-lst, .zoo, .zoo-lst]
hoc-7.0.5.beta [.1, .html, .info, .jar, .jar-lst, .tar.bz2, .tar.gz, .tar-lst, .texi, .zip, .zip-lst, .zoo, .zoo-lst]
hoc-7.0.6.beta [.1, .html, .info, .jar, .jar-lst, .tar.bz2, .tar.gz, .tar-lst, .texi, .zip, .zip-lst, .zoo, .zoo-lst]
Note added Thu Dec 5 18:04:11 2002:
hoc documentation up to and including hoc-7.0.6.beta says that the MIPS architecture supports only one kind of NaN. That statement was based on information from two published books on the architecture, but has now been determined to be incorrect for at least processors from the MIPS R4000 onward. The error will be corrected in hoc-7.0.7.beta, but there is no projected date for release of that version.

Installation instructions are included in all of the source distributions. You can see them in advance here.

hoc has been extensively tested on about 15 different UNIX platforms with dozens of C and C++ compilers.

hoc can be built with any of these parser generators:

Most GNU, POSIX, and UNIX systems have yacc standardly installed.

Many also have bison, which is available in the Free Software Foundation's GNU Project archive.

byacc is harder to find, because there is no official distribution site for it, although copies of various provenance can be found at many places on the Internet. The hoc maintainer has collected several such versions, which seem to have incompatible development lines, and after correspondence with byacc's original author, who no longer maintains the program, the best, and most modern, choice appears to be this version: byacc-990830 It has been GNU autoconfigurized, and thus builds, validates, and installs as easily as GNU bison.

All of these parser generators are highly reliable, and there is no particular reason to favor one over the other. Nevertheless, for a computer language developer, it is extremely gratifying to be able to get identical results from three different parser generators, since LALR(1) parser code is effectively impossible to produce by hand.

The hoc version 7 LALR(1) grammar is only about 180 lines of clear and well-documented code, so one can have a high-degree of confidence in its correctness, provided that the parser generator works correctly.

An LL(1) parser could be written by hand, and so not require an external parser generator like yacc, but it would take much more than 160 lines of code, and would be much more difficult to verify.

The old versions 1 through 6 of hoc that are described in the book cited in the documentation are available at the Bell Labs Web site: