Eqn (software)

Last updated
eqn
Original author(s) Brian Kernighan,
Lorinda Cherry
(AT&T Bell Laboratories)
Developer(s) Various open-source and commercial developers
Initial releaseJune 1974;49 years ago (1974-06)
Written in C, Yacc [1]
Operating system Unix, Unix-like, Plan 9
Platform Cross-platform
Type Command
License Plan 9: MIT License

Part of the troff suite of Unix document layout tools, eqn is a preprocessor that formats equations for printing. A similar program, neqn, accepted the same input as eqn, but produced output tuned to look better in nroff. The eqn program was created in 1974 by Brian Kernighan and Lorinda Cherry. It was implemented using yacc compiler-compiler. [1]

Contents

The input language used by eqn allows the user to write mathematical expressions in much the same way as they would be spoken aloud. The language is defined by a context-free grammar, together with operator precedence and operator associativity rules. [2] The eqn language is similar to the mathematical component of TeX, which appeared several years later, but is simpler and less complete.

An independent compatible implementation of the eqn preprocessor has been developed by GNU as part of groff, the GNU version of troff. The GNU implementation extends the original language by adding a number of new keywords such as smallover and accent. mandoc, a specialised compiler for UNIX man pages, also contains a standalone eqn parser/formatter.

History

Eqn was written using the yacc parser generator. [1]

Syntax examples

Here is how some examples would be written in eqn [3] (with equivalents in TeX for comparison):

TeXeqnformula
a^2a sup 2
\sum_{k = 1}^N k^2sum from { k = 1 } to N { k sup 2 }
x = {-b \pm\sqrt{b^2 - 4ac}\over 2a}x = {-b +- sqrt{b sup 2 - 4ac}} over 2a

Spaces are important in eqn; tokens are delimited only by whitespace characters, tildes ~, braces {} and double-quotes "". Thus f(pi r sup 2) results in , whereas f( pi r sup 2 ) is needed to give the intended .

Related Research Articles

<span class="mw-page-title-main">AWK</span> Programming language

AWK is a domain-specific language designed for text processing and typically used as a data extraction and reporting tool. Like sed and grep, it is a filter, and is a standard feature of most Unix-like operating systems.

<span class="mw-page-title-main">Brian Kernighan</span> Canadian computer scientist, co-creator of the Unix operating system

Brian Wilson Kernighan is a Canadian computer scientist. He worked at Bell Labs and contributed to the development of Unix alongside Unix creators Ken Thompson and Dennis Ritchie. Kernighan's name became widely known through co-authorship of the first book on the C programming language with Dennis Ritchie. Kernighan affirmed that he had no part in the design of the C language.

TeX, stylized within the system as TeX, is a typesetting system which was designed and written by computer scientist and Stanford University professor Donald Knuth and first released in 1978. TeX is a popular means of typesetting complex mathematical formulae; it has been noted as one of the most sophisticated digital typographical systems.

troff, short for "typesetter roff", is the major component of a document processing system developed by Bell Labs for the Unix operating system. troff and the related nroff were both developed from the original roff.

Yacc is a computer program for the Unix operating system developed by Stephen C. Johnson. It is a lookahead left-to-right rightmost derivation (LALR) parser generator, generating a LALR parser based on a formal grammar, written in a notation similar to Backus–Naur form (BNF). Yacc is supplied as a standard utility on BSD and AT&T Unix. GNU-based Linux distributions include Bison, a forward-compatible Yacc replacement.

Lex is a computer program that generates lexical analyzers. It is commonly used with the yacc parser generator and is the standard lexical analyzer generator on many Unix and Unix-like systems. An equivalent tool is specified as part of the POSIX standard.

<span class="mw-page-title-main">GNU TeXmacs</span> Open-source word processor

GNU TeXmacs is a scientific word processor and typesetting component of the GNU Project. It originated as a variant of GNU Emacs with TeX functionalities, though it shares no code with those programs, while using TeX fonts. It is written and maintained by Joris van der Hoeven and a group of developers. The program produces structured documents with a WYSIWYG user interface. New document styles can be created by the user. The editor provides high-quality typesetting algorithms and TeX and other fonts for publishing professional looking documents.

Joseph Frank Ossanna, Jr. was an American electrical engineer and computer programmer who worked as a member of the technical staff at the Bell Telephone Laboratories in Murray Hill, New Jersey. He became actively engaged in the software design of Multics, a general-purpose operating system used at Bell.

Flex is a free and open-source software alternative to lex. It is a computer program that generates lexical analyzers . It is frequently used as the lex implementation together with Berkeley Yacc parser generator on BSD-derived operating systems, or together with GNU bison in *BSD ports and in Linux distributions. Unlike Bison, flex is not part of the GNU Project and is not released under the GNU General Public License, although a manual for Flex was produced and published by the Free Software Foundation.

Ratfor is a programming language implemented as a preprocessor for Fortran 66. It provides modern control structures, unavailable in Fortran 66, to replace GOTOs and statement numbers.

m4 is a general-purpose macro processor included in most Unix-like operating systems, and is a component of the POSIX standard.

bc, for basic calculator, is "an arbitrary-precision calculator language" with syntax similar to the C programming language. bc is typically used as either a mathematical scripting language or as an interactive mathematical shell.

<i>The Unix Programming Environment</i> Book by Brian Kernighan

The Unix Programming Environment, first published in 1984 by Prentice Hall, is a book written by Brian W. Kernighan and Rob Pike, both of Bell Labs and considered an important and early document of the Unix operating system.

groff (software) Unix typesetting software used for man pages

groff is a typesetting system that creates formatted output when given plain text mixed with formatting commands. It is the GNU replacement for the troff and nroff text formatters, which were both developed from the original roff.

refer is a program for managing bibliographic references, and citing them in troff, nroff, and groff documents. It is implemented as a preprocessor.

In computing, Pic is a domain-specific programming language by Brian Kernighan for specifying line diagrams. The language contains predefined basic linear objects: line, move, arrow, and spline, the planar objects box, circle, ellipse, arc, and definable composite elements. Objects are placed with respect to other objects or absolute coordinates. A liberal interpretation of the input invokes default parameters when objects are incompletely specified. An interpreter translates this description into concrete drawing commands in a variety of possible output formats. Pic is a procedural programming language, with variable assignment, macros, conditionals, and looping. The language is an example of a little language originally intended for the comfort of non-programmers in the Unix environment.

A mathematical markup language is a computer notation for representing mathematical formulae, based on mathematical notation. Specialized markup languages are necessary because computers normally deal with linear text and more limited character sets. A formally standardized syntax also allows a computer to interpret otherwise ambiguous content, for rendering or even evaluating. For computer-interpretable syntaxes, the most popular are TeX/LaTeX, MathML, OpenMath and OMDoc.

<span class="mw-page-title-main">Unix</span> Family of computer operating systems

Unix is a family of multitasking, multi-user computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and others.

<span class="mw-page-title-main">Lorinda Cherry</span> Computer scientist and original Unix team member (1944–2022)

Lorinda Cherry was an American computer scientist and programmer. Much of her career was spent at Bell Labs, where she was for many years a member of the original Unix Lab. Cherry developed several mathematical tools and utilities for text formatting and analysis, and influenced the creation of others.

The GSI C/A/T is a phototypesetter developed by Graphic Systems in 1972. This phototypesetter, along with troff software for UNIX, revolutionized the typesetting and document printing industry. Phototypesetting is most often used with offset printing technology.

References

  1. 1 2 3 "UNIX Special: Profs Kernighan & Brailsford". Computerphile. September 30, 2015. Archived from the original on 2021-12-22.
  2. Kernighan, Brian W.; Cherry, Lorinda L. (1975). "A System for Typesetting Mathematics". Communications of the ACM . 18 (3): 151–157. doi: 10.1145/360680.360684 . S2CID   155801.
  3. Kernighan, Brian W.; Cherry, Lorinda (1978), Typesetting Mathematics — User’s Guide (PDF) (2nd ed.)