Last update: Tue Jan 1 15:43:43 2002
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:
The source distribution is available in these formats:
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.tar.gz 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: