eqn (software)

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
eqn
Original authorsBrian Kernighan,
Lorinda Cherry
(AT&T Bell Laboratories)
DevelopersVarious open-source and commercial developers
Initial releaseJune 1974; 52 years ago (1974-06)
Repository
  • {{URL|example.com|optional display text}}Lua error in Module:EditAtWikidata at line 29: attempt to index field 'wikibase' (a nil value).
Written inC, Yacc[1]
Engine
    Lua error in Module:EditAtWikidata at line 29: attempt to index field 'wikibase' (a nil value).
    Operating systemUnix, Unix-like, Plan 9
    PlatformCross-platform
    TypeCommand
    LicensePlan 9: MIT License
    groff: GPL-3.0-or-later

    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 the yacc compiler-compiler.[1]

    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

    [edit | edit source]

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

    Syntax examples

    [edit | edit source]

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

    TeX eqn formula
    a^2 a sup 2 a2
    \sum_{k = 1}^N k^2 sum from { k = 1 } to N { k sup 2 } k=1Nk2
    x = {-b \pm \sqrt{b^2 - 4ac} \over 2a} x = {-b +- sqrt{b sup 2 - 4ac}} over 2a x=b±b24ac2a

    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 f(pir2), whereas f( pi r sup 2 ) is needed to give the intended f(πr2).

    References

    [edit | edit source]
    1. ^ a b c Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
    2. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
    3. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
    [edit | edit source]