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, e ...
, Pic is a
domain-specific
Domain specificity is a theoretical position in cognitive science (especially modern cognitive development) that argues that many aspects of cognition are supported by specialized, presumably evolutionarily specified, learning devices. The posit ...
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 ...
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-au ...
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
Procedural programming is a programming paradigm, derived from imperative programming, based on the concept of the ''procedure call''. Procedures (a type of routine or subroutine) simply contain a series of computational steps to be carried ...
, 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 (
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, North ...
1988).
History
Pic was implemented using
Yacc
Yacc (Yet Another Compiler-Compiler) is a computer program for the Unix operating system developed by Stephen C. Johnson. It is a Look Ahead Left-to-Right Rightmost Derivation (LALR) parser generator, generating a LALR parser (the part of a com ...
compiler-compiler.
Implementations
Pic was first implemented as a
preprocessor
In computer science, a preprocessor (or precompiler) is a program that processes its input data to produce output that is used as input in another program. The output is said to be a preprocessed form of the input data, which is often used by so ...
in the
troff
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.
While nroff was inten ...
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 (angiosperms ...
. 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 tha ...
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
GNU () is an extensive collection of free software (383 packages as of January 2022), which can be used as an operating system or can be used in parts with other operating systems. The use of the completed GNU tools led to the family of operat ...
version of troff. GNU pic can also act as a preprocessor for
TeX
Tex may refer to:
People and fictional characters
* Tex (nickname), a list of people and fictional characters with the nickname
* Joe Tex (1933–1982), stage name of American soul singer Joseph Arrington Jr.
Entertainment
* ''Tex'', the Italian ...
documents, emitting its own tpic
DVI specials
The device independent file format (DVI) is the output file format of the TeX typesetting program, designed by David R. Fuchs and implemented by Donald E. Knuth in 1982. Unlike the TeX markup files used to generate them, DVI files are not inte ...
, 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 (angiosperms ...
-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 ...
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
Markdown is a lightweight markup language for creating formatted text using a plain-text editor. John Gruber and Aaron Swartz created Markdown in 2004 as a markup language that is appealing to human readers in its source code form. Markdown is ...
, instead of
troff
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.
While nroff was inten ...
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 (angiosperms ...
. 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, 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
SQLite (, ) is a database engine written in the C programming language. It is not a standalone app; rather, it is a library that software developers embed in their apps. As such, it belongs to the family of embedded databases. It is the most ...
, 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
DOT is a graph description language. DOT graphs are typically files with the filename extension ''gv'' or ''dot''. The extension ''gv'' is preferred, to avoid confusion with the extension ''dot'' used by versions of Microsoft Word before 2007.
...
.
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