In
computing
Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes, and development of both hardware and software. Computing has scientific, ...
, Pic is a
domain-specific programming language
A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language.
The description of a programming l ...
by
Brian Kernighan
Brian Wilson Kernighan (; born 1942) 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 ...
for specifying line
diagram
A diagram is a symbolic representation of information using visualization techniques. Diagrams have been used since prehistoric times on walls of caves, but became more prevalent during the Enlightenment. Sometimes, the technique uses a three ...
s.
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
A domain-specific language (DSL) is a computer language specialized to a particular application domain. This is in contrast to a general-purpose language (GPL), which is broadly applicable across domains. There are a wide variety of DSLs, ranging ...
'' originally intended for the comfort of non-programmers in the Unix environment (
Bentley
Bentley Motors Limited is a British designer, manufacturer and marketer of luxury cars and SUVs. Headquartered in Crewe, England, the company was founded as Bentley Motors Limited by W. O. Bentley (1888–1971) in 1919 in Cricklewood, Nort ...
1988).
History
Pic was implemented using
Yacc compiler-compiler.
Implementations
Pic was first implemented as a
preprocessor in the
troff document processing system but is now often used with
LaTeX
Latex is an emulsion (stable dispersion) of polymer microparticles in water. Latexes are found in nature, but synthetic latexes are common as well.
In nature, latex is found as a milky fluid found in 10% of all flowering plants (angiosper ...
. The pic preprocessor
filters
Filter, filtering or filters may refer to:
Science and technology
Computing
* Filter (higher-order function), in functional programming
* Filter (software), a computer program to process a data stream
* Filter (video), a software component th ...
a source document, replacing diagram descriptions by drawing commands in a specified format, and passing the rest of the document through without change. Alternatively, diagram source is passed through the preprocessor to produce a file for insertion into the
document source.
A version of pic is included in
groff, the
GNU version of troff. GNU pic can also act as a preprocessor for
TeX documents, emitting its own tpic
DVI specials, which aren't as widely supported as those of other TeX graphic facilities.
Arbitrary diagram text can be included for formatting by the word processor to which the pic output is directed, and arbitrary graphic processor commands can also be included.
DPIC
Dwight Aplevich's implementation
DPIC can also generate pdf, postscript, svg, and other images by itself, as well as act as a preprocessor producing several
LaTeX
Latex is an emulsion (stable dispersion) of polymer microparticles in water. Latexes are found in nature, but synthetic latexes are common as well.
In nature, latex is found as a milky fluid found in 10% of all flowering plants (angiosper ...
-compatible output formats. The three principal sources of pic processors are GNU pic, found on many
Linux
Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, which i ...
systems, and dpic, both of which are free, and the original AT&T pic.
Pikchr
'
Pikchr'' (pronounced "picture") is a modern replacement for Pic in some contexts, designed to be embedded in
Markdown, instead of
troff or
LaTeX
Latex is an emulsion (stable dispersion) of polymer microparticles in water. Latexes are found in nature, but synthetic latexes are common as well.
In nature, latex is found as a milky fluid found in 10% of all flowering plants (angiosper ...
. It should run most of the example scripts contained in the original technical report on Pic with little to no change. Created by
D. Richard Hipp
Dwayne Richard Hipp (born April 9, 1961) is an American software developer and the primary author of SQLite as well as the Fossil (software), Fossil SCM. He also authored the Lemon (parser generator), Lemon parser generator, and CVSTrac; the latt ...
, in August 2020,
it is used in
Fossil
A fossil (from Classical Latin , ) is any preserved remains, impression, or trace of any once-living thing from a past geological age. Examples include bones, shells, exoskeletons, stone imprints of animals or microbes, objects preserved ...
,
SQLite, an
Subplot
Alternatives
Pic has some similarity with
MetaPost
MetaPost refers to both a programming language and the interpreter of the MetaPost programming language. Both are derived from Donald Knuth's Metafont language and interpreter. MetaPost produces vector graphic diagrams from a geometric/algebra ...
and the
DOT language.
See also
*
Eqn language
References
;Notes
*
*J. Bentley. ''More Programming Pearls'', Addison-Wesley (1988).
External links
Making Pictures With GNU PICDPIC an implementation of the PIC language by Dwight Aplevich. This implementation has a few nice extensions and outputs many different image formats.
figr web based pic renderer.
*
"''takes one or more files in the pic language, and either displays the figures that they contain on an X Window System display, or produces an output file containing the figures. Many graphics file formats are supported.''"
Pikchr
{{Programming languages
Programming languages
Markup languages
Troff
Programming languages created in 1980
1980 software