encyclopegia.org

Hoc (programming language)

hoc, an acronym for High Order Calculator, is an interpreted programming language that was used in the 1984 book The Unix Programming Environment to demonstrate how to build interpreters using Yacc.[src] hoc was developed by Brian Kernighan and Rob Pike as a glorified interactive calculator.[src] Its basic functionality is to evaluate floating-point numerical expressions, e.g., .[src] Then, variables were added, conditionals, loops, user-defined functions, simple IO, and more, using a syntax resembling C.[src] An improved hoc interpreter was included in Eighth Edition Research Unix in 1985, but it has not been generally adopted by commercial Unix systems or by Linux distributions.[src] Instead, the earlier calculator languages dc and bc have become widespread on those systems.[src] hoc survived and continued to evolve as part of the Plan 9 operating system.[src] Several improved versions of hoc were released as free software by Bell Labs and other individuals (see list below).[src] hoc is used, alongside python, as a scripting language for the Neuron simulator.[src]

hoc, an acronym for High Order Calculator, is an interpreted programming language that was used in the 1984 book The Unix Programming Environment to demonstrate how to build interpreters using Yacc.[src] hoc was developed by Brian Kernighan and Rob Pike as a glorified interactive calculator.[src] Its basic functionality is to evaluate floating-point numerical expressions, e.g., .[src] Then, variables were added, conditionals, loops, user-defined functions, simple IO, and more, using a syntax resembling C.[src] An improved hoc interpreter was included in Eighth Edition Research Unix in 1985, but it has not been generally adopted by commercial Unix systems or by Linux distributions.[src] Instead, the earlier calculator languages dc and bc have become widespread on those systems.[src] hoc survived and continued to evolve as part of the Plan 9 operating system.[src] Several improved versions of hoc were released as free software by Bell Labs and other individuals (see list below).[src] hoc is used, alongside python, as a scripting language for the Neuron simulator.[src] ==Examples== The following is a simple example of an interactive calculator session in hoc; text represents hoc's output: 1+2*3 7 angle=PI/3 r=sin(angle) r 0.866025 r*2 1.73205 And a simple example of functions and flow control: func atan2(){ if ($1>0){ return atan($2/$1) } else if ($1 0){ return PI/2 } else if ($2 ==External links== ===hoc implementations and versions=== AT&T versions: The original code from the Unix Programming Environment book, including hoc.[src] Source code of hoc from Bell Labs, released as free software.[src] This is the Research Unix version, slightly improved over the one in the book.[src] Plan9 version of hoc released under the MIT License.[src] This version is slightly different from the Research Unix version, with the most notable difference being that numbered function arguments ($1, $2, etc., as in the Unix shell) were replaced by named arguments (as in C).[src] See also Plan 9's hoc manual.[src] Other versions: an extended version of hoc by Nelson H.[src] F.[src] Beebe.[src] an extended version of hoc by Nadav Y.[src] Har'El.[src] an extended version of hoc by Jack Dennon.[src] an extended version of hoc by Michael Hines, John W.[src] Moore, and Ted Carnevale.[src]

32 sentences · 32 cited inline · 0 references stored

References

No reference rows published for this article.

Cite this article

MLA

"Hoc (programming language)." encyclopegia.org, 2025, https://encyclopegia.org/wiki/hoc-programming-language. Accessed 25 November 2026.

Chicago

"Hoc (programming language)." encyclopegia.org. Accessed November 25, 2026. https://encyclopegia.org/wiki/hoc-programming-language.

APA

encyclopegia.org. (2025). Hoc (programming language). Retrieved November 25, 2026, from https://encyclopegia.org/wiki/hoc-programming-language

Accessed November 25, 2026 · CC BY-SA 4.0 · citation page · JSON

Related articles

official language

stub · references available

pan-Slavic language

stub · references available

Hawaiʻi Sign Language

stub · references available

Taiwanese Sign Language

stub · references available

Category:Programming languages

stub · references available

International Mother Language Day

stub · references available

polysynthetic language

stub · references available

Category:Films by country or language

stub · references available
CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1271944760 · 0.5 · snapshot enwiki-001271944760

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.