Backslash

The backslash (\) is a typographical mark used mainly in computing and is the mirror image of the common slash (/). It is sometimes called a hack, whack, escape (from C/UNIX), reverse slash, slosh, downwhack, backslant, backwhack, bash, reverse slant, and reversed virgule.[1][2] In Unicode and ASCII it is encoded at U+005C \ REVERSE SOLIDUS (92decimal).

\
Backslash
 ⧵   ⧹ 
Reverse solidus operator Big reverse solidus Fullwidth reverse solidus

History

Bob Bemer introduced the \ character into ASCII[3] on September 18, 1961,[4] as the result of character frequency studies. In particular, the \ was introduced so that the ALGOL boolean operators ∧ (and) and ∨ (or) could be composed in ASCII as /\ and \/ respectively.[4][5] Both these operators were included in early versions of the C programming language supplied with Unix V6, Unix V7 and more currently BSD 2.11.

Usage

In many programming languages such as C, Perl, PHP, Python and in Unix scripting languages, the backslash is used as an escape character, to indicate that the character following it should be treated specially (if it would otherwise be treated normally), or normally (if it would otherwise be treated specially). For instance inside a C quoted string the sequence \n produces a newline byte instead of an 'n', and the sequence \" produces an actual double quote rather than the special meaning of the double quote ending the string. In various regular expression languages it is used this way, changing subsequent literal characters into metacharacters and vice versa. Following this usage, the double backslash sequence \\ produces a normal literal backslash.

Outside strings, the only common use in languages is at the end of a line to indicate that the trailing newline character should be ignored, so that the following line is treated as if it were part of the current line. In this context it may be called a "continuation".[6]

The ALGOL 68 programming language uses the "\" as its Decimal Exponent Symbol. ALGOL 68 has the choice of 4 Decimal Exponent Symbols: e, E, \, or 10. Examples: 6.0221415e23, 6.0221415E23, 6.0221415\23 or 6.02214151023.[7]

In APL \ is called Expand when used to insert fill elements into arrays, and Scan when used to produce prefix reduction (cumulative fold).

The backslash is used in the TeX typesetting system and in RTF files to begin markup tags. In Haskell, the backslash is used both to introduce special characters and to introduce lambda functions (since it is a reasonable approximation in ASCII of the Greek letter lambda, λ).[8]

MS-DOS 2.0, released 1983, copied the hierarchical file system from Unix and thus used the (forward) slash, but (possibly on the insistence of IBM) added the backslash to allow paths to be typed at the command line interpreter's prompt while retaining compatibility with MS-DOS 1.0 where the slash was the command-line option indicator (typing "DIR/W" gave the "wide" option to the "DIR" command, so some other method was needed if you actually wanted to run a program called W inside a directory called DIR).[9] Except for COMMAND.COM, all other parts of the operating system accept both characters in a path, but the Microsoft convention remains to use a backslash, and APIs that return paths use backslashes.[10] In some versions, the option character can be changed from / to - via SWITCHAR, which allows COMMAND.COM to preserve / in the command name.

The Microsoft Windows family of operating systems inherited the MS-DOS behavior and so still support either character – but individual Windows programs and sub-systems may, wrongly, only accept the backslash as a path delimiter, or may misinterpret a forward slash if it is used as such. Some programs will only accept forward slashes if the path is placed in double-quotes.[11] The failure of Microsoft's security features to recognize unexpected-direction slashes in local and Internet paths, while other parts of the operating system still act upon them, has led to some serious lapses in security. Resources that should not be available have been accessed with paths using particular mixes, such as http://example.net/secure\private.aspx.[12][13]

In mathematics, a backslash-like symbol is used for the set difference.[14] The backslash is also sometimes used to denote the right coset space.[15]

In some dialects of the BASIC programming language, the backslash is used as an operator symbol to indicate integer division.[16]

In MATLAB and GNU Octave the backslash is used for left matrix divide, while the slash is for right matrix divide.[17]

In PHP version 5.3 and higher, the backslash is used to indicate a namespace.[18]

In USFM,[19] the backslash is used to mark format features for editing Bible translations.

Confusion in usage

In the Japanese encodings ISO 646 (a 7-bit code based on ASCII), JIS X 0201 (an 8-bit code), and Shift JIS (a multi-byte encoding which is 8-bit for ASCII), the code point 0x5C that would be used for backslash in ASCII is instead rendered as a yen mark (¥), while in Korean encoding, it is drawn as a won currency symbol (₩). Computer programs still treat the code as a backslash in these environments, causing confusion, especially in MS-DOS filenames.[20] Due to extensive use of the backslash code point to represent the yen mark, even today some Unicode fonts like MS Mincho render the backslash character as a ¥, so the Unicode characters 00A5 (¥) and 005C (\) look identical when these fonts are selected. Several other ISO 646 versions also replace backslash with characters like Ö (German, Swedish), Ø (Danish, Norwegian), ç (French) and Ñ (Spanish), leading to similar problems. Since the character was originally not available in all character sets and keyboard layouts, ANSI C can transcribe it in form of the trigraph ??/ which, even within string literals, is equivalent to the \ character. RFC 1345 recommends to transcribe the character as digraph //, if not available.[21][22]

References

  1. ^ Macquarie Dictionary (3rd edition)
  2. ^ Raymond, Eric S. "ASCII".
  3. ^ "Mini-Biography of Bob Bemer". Thocp.net. Retrieved 2013-06-16.
  4. ^ a b "How ASCII Got Its Backslash", Bob Bemer
  5. ^ Bob Bemer (2002-07-07). "The Great Curly Brace Trace Chase". Computer History Vignettes. Bob Bemer. Archived from the original on 2009-06-04. Retrieved 2009-10-11.
  6. ^ "GNU 'make' manual". Gnu.org. Retrieved 2013-06-16.
  7. ^ "Revised Report on the Algorithmic Language Algol 68". September 1973. Retrieved April 30, 2007.
  8. ^ O'Sullivan, Stewart, and Goerzen, Real World Haskell, ch. 4: anonymous (lambda) functions, p.99
  9. ^ "Why is the DOS path character "\"?". Blogs.msdn.com. 2005-06-24. Retrieved 2013-06-16.
  10. ^ "Path.GetFullPath Method". .NET Framework Class Library. Microsoft. Archived from the original on 21 December 2008. Retrieved 2009-01-02.
  11. ^ "When did Windows start accepting forward slash as a path separator?". Bytes.com. Archived from the original on 6 February 2009. Retrieved 2009-01-02.
  12. ^ Kaplan, Simone (2004). "Microsoft Probes Flaw in ASP.NET". DevSource, sponsored by Microsoft. Ziff Davis Enterprise Holdings Inc. Archived from the original on 2013-01-21. Retrieved 2009-06-14.
  13. ^ Burnett, Mark (2004). "Security Holes That Run Deep". SecurityFocus. Retrieved 2009-06-14.
  14. ^ "Quantities and units – Part 2: Mathematical signs and symbols to be used in the natural sciences and technology". ISO 80000-2:2009. International Organization for Standardization.
  15. ^ "Definition:Coset Space". ProofWiki. Retrieved 1 February 2017.
  16. ^ "Arithmetic Operators in Visual Basic". Visual Basic Language Features: Operators and Expressions. MSDN. Retrieved 7 October 2012.
  17. ^ Eaton, John W.; David Bateman; Søren Hauberg (February 2011). "GNU Octave: A high-level interactive language for numerical computations" (PDF). Free Software Foundation. p. 145. Retrieved 7 October 2012.
  18. ^ "Namespaces overview".
  19. ^ "USFM – Unified Standard Format Markers". paratext.org.
  20. ^ "When is a backslash not a backslash?". Blogs.msdn.com. Retrieved 2013-06-16.
  21. ^ "RFC 1345". Tools.ietf.org. 1991-12-26. Retrieved 2013-06-16.
  22. ^ "World ENews 1345". Tools.ietf.org. 1991-12-26. Retrieved 2013-06-16.

External links

Categorial grammar

Categorial grammar is a term used for a family of formalisms in natural language syntax motivated by the principle of compositionality and organized according to the view that syntactic constituents should generally combine as functions or according to a function-argument relationship. Most versions of categorial grammar analyze sentence structure in terms of constituencies (as opposed to dependencies) and are therefore phrase structure grammars (as opposed to dependency grammars).

Code page 903

Code page 903 is encoded for use as the single byte component of certain simplified Chinese character encodings. It is used in China. Despite this, it follows ISO 646-JP / the Roman half of JIS X 0201, in that it replaces the ASCII backslash 0x5C (rather than the ASCII dollar sign 0x24 as in GB 1988 / ISO 646-CN) with the yen/yuan sign. It also uses the same C0 replacement graphics as code page 897. When combined with the double-byte Code page 928, it forms the two code-sets of IBM code page 936.

Code page 932 (Microsoft Windows)

Microsoft Windows code page 932 (abbreviated MS932, Windows-932 or ambiguously CP932), also called Windows-31J amongst other names (see § Terminology below), is the Microsoft Windows code page for the Japanese language, which is an extended variant of the Shift JIS Japanese character encoding. It contains standard 7-bit ASCII codes, and Japanese characters are indicated by the high bit of the first byte being set to 1. Some code points in this page require a second byte, so characters use either 8 or 16 bits for encoding.

IBM offer the same extended double-byte codes in their code page 943 (IBM-943 or CP943), which is a combination of the single-byte Code page 897 and the double-byte Code page 941.

Code page 942

Code page 942 (abbreviated as CP942 or IBM-942) is one of IBM's extensions of Shift JIS. The coded character sets are JIS X 0201, JIS X 0208, IBM extensions for IBM 1880 UDC and IBM extensions. It is the combination of the single-byte Code page 1041 and the double-byte Code page 301.It is a superset of IBM-932, differing in its use of Code page 1041 in place of Code page 897 for its single byte codes. Code page 1041 is an extension of Code page 897 and adds five single-byte characters. 0x80 is mapped to the cent sign (¢), 0xA0 is mapped to the pound sign (£), 0xFD is mapped to the not sign (¬), 0xFE is mapped to the backslash (\) and 0xFF is mapped to the tilde (~). These are all unassigned in Code page 897 and therefore IBM-932.Code page 942 contains standard 7-bit ISO 646 codes, and Japanese characters are indicated by the high bit of the first byte being set to 1. Some code points in this page require a second byte, so characters use either 8 or 16 bits for encoding.

Code page 1041, and therefore Code page 942, uses 0x5C for the Yen sign (¥) and 0x7E for the overline (‾), matching the lower half of JIS X 0201 rather than US-ASCII. However, the version of Code page 942 used in International Components for Unicode (called "ibm-942_P12A-1999" or "x-IBM942C") uses US-ASCII mappings for single-byte characters between 0x20 and 0x7E. This results in duplicate mapping for the tilde (0x7E and 0xFF) and the backslash (0x5C and 0xFE).

Double coset

In group theory, a field of mathematics, a double coset is a collection of group elements which are equivalent under the symmetries coming from two subgroups. More precisely, let G be a group, and let H and K be subgroups. Let H act on G by left multiplication while K acts on G by right multiplication. For each x in G, the (H, K)-double coset of x is the set

When H = K, this is called the H-double coset of x. Equivalently, HxK is the equivalence class of x under the equivalence relation

x ~ y if and only if there exist h in H and k in K such that hxk = y.

The set of all double cosets is denoted

Escape character

In computing and telecommunication, an escape character is a character which invokes an alternative interpretation on subsequent characters in a character sequence. An escape character is a particular case of metacharacters. Generally, the judgment of whether something is an escape character or not depends on context.

Escape sequence

An escape sequence is a combination of characters that has a meaning other than the literal characters contained therein; it is marked by one or more preceding (and possibly terminating) characters.

Fast-growing hierarchy

In computability theory, computational complexity theory and proof theory, a fast-growing hierarchy (also called an extended Grzegorczyk hierarchy) is an ordinal-indexed family of rapidly increasing functions fα: N → N (where N is the set of natural numbers {0, 1, ...}, and α ranges up to some large countable ordinal). A primary example is the Wainer hierarchy, or Löb–Wainer hierarchy, which is an extension to all α < ε0. Such hierarchies provide a natural way to classify computable functions according to rate-of-growth and computational complexity.

Interior (topology)

In mathematics, specifically in topology, the interior of a subset S of points of a topological space X consists of all points of S that do not belong to the boundary of S. A point that is in the interior of S is an interior point of S.

The interior of S is the complement of the closure of the complement of S. In this sense interior and closure are dual notions.

The exterior of a set is the interior of its complement, equivalently the complement of its closure; it consists of the points that are in neither the set nor its boundary. The interior, boundary, and exterior of a subset together partition the whole space into three blocks (or fewer when one or more of these is empty). The interior and exterior are always open while the boundary is always closed. Sets with empty interior have been called boundary sets.

Leaning toothpick syndrome

In computer programming, leaning toothpick syndrome (LTS) is the situation in which a quoted expression becomes unreadable because it contains a large number of escape characters, usually backslashes ("\"), to avoid delimiter collision.The official Perl documentation introduced the term to wider usage; there, the phrase is used to describe regular expressions that match Unix-style paths, in which the elements are separated by slashes /. The slash is also used as the default regular expression delimiter, which must be escaped with a backslash, \, leading to frequent escaped slashes represented as \/. If doubled, as in URLs, this yields \/\/ for an escaped //. A similar phenomenon occurs for DOS/Windows paths, where the backslash is used as a path separator, requiring a doubled backslash \\ – this can then be re-escaped for a regular expression inside an escaped string, requiring \\\\ to match a single backslash. In extreme cases, such as a regular expression in escaped string, matching a Uniform Naming Convention path (which begins \\) this requires 8 backslashes \\\\\\\\ due to 2 backslashes each being double-escaped.

LTS appears in many programming languages and in many situations, including in patterns that match Uniform Resource Identifiers (URIs) and in programs that output quoted text. Many quines fall into the latter category.

Maass wave form

In mathematics, Maass forms or Maass wave forms are studied in the theory of automorphic forms. Maass forms are complex-valued smooth functions of the upper half plane, which transform in a similar way under the operation of a discrete subgroup of as modular forms. They are Eigenforms of the hyperbolic Laplace Operator defined on and satisfy certain growth conditions at the cusps of a fundamental domain of . In contrast to the modular forms the Maass forms need not be holomorphic. They were studied first by Hans Maass in 1949.

Metacharacter

A metacharacter is a character that has a special meaning to a computer program, such as a shell interpreter or a regular expression (regex) engine.

In POSIX extended regular expressions, there are 14 metacharacters that must be escaped (preceded by a backslash ("\")) in order to drop their special meaning and be treated literally inside an expression: opening and closing square brackets ("[" and "]"); backslash ("\"); caret ("^"); dollar sign ("$"); period/full stop/dot ("."); vertical bar/pipe symbol ("|"); question mark ("?"); asterisk ("*"); plus sign ("+"); opening and closing curly brackets/braces ("{" and "}"); and opening and closing parentheses ("(" and ")").For example, to match the arithmetic expression "(1+1)*3=6" with a regex, the correct regex is "\(1\+1\)\*3=6"; otherwise, the parentheses, plus sign, and asterisk will have special meanings.

Path (computing)

A path, the general form of the name of a file or directory, specifies a unique location in a file system. A path points to a file system location by following the directory tree hierarchy expressed in a string of characters in which path components, separated by a delimiting character, represent each directory. The delimiting character is most commonly the slash ("/"), the backslash character ("\"), or colon (":"), though some operating systems may use a different delimiter. Paths are used extensively in computer science to represent the directory/file relationships common in modern operating systems, and are essential in the construction of Uniform Resource Locators (URLs). Resources can be represented by either absolute or relative paths.

Principal homogeneous space

For the term "torsor" in algebraic geometry, see torsor (algebraic geometry).In mathematics, a principal homogeneous space, or torsor, for a group G is a homogeneous space X for G in which the stabilizer subgroup of every point is trivial. Equivalently, a principal homogeneous space for a group G is a non-empty set X on which G acts freely and transitively (meaning that, for any x, y in X, there exists a unique g in G such that x·g = y, where · denotes the (right) action of G on X).

An analogous definition holds in other categories, where, for example,

G is a topological group, X is a topological space and the action is continuous,

G is a Lie group, X is a smooth manifold and the action is smooth,

G is an algebraic group, X is an algebraic variety and the action is regular.

Quasigroup

In mathematics, especially in abstract algebra, a quasigroup is an algebraic structure resembling a group in the sense that "division" is always possible. Quasigroups differ from groups mainly in that they are not necessarily associative.

A quasigroup with an identity element is called a loop.

Slash (punctuation)

The slash is an oblique slanting line punctuation mark. Once used to mark periods and commas, the slash is now most often used to represent exclusive or inclusive or, division and fractions, and as a date separator. It is called a solidus in Unicode, is sometimes known as a stroke in British English, and it has several other historical or technical names, including oblique and virgule.

A slash in the reverse direction (\) is known as a backslash.

String literal

A string literal or anonymous string is a type of literal in programming for the representation of a string value within the source code of a computer program. Most often in modern languages this is a quoted sequence of characters (formally "bracketed delimiters"), as in x = "foo", where "foo" is a string literal with value foo – the quotes are not part of the value, and one must use a method such as escape sequences to avoid the problem of delimiter collision and allow the delimiters themselves to be embedded in a string. However, there are numerous alternate notations for specifying string literals, particularly more complicated cases, and the exact notation depends on the individual programming language in question. Nevertheless, there are some general guidelines that most modern programming languages follow.

Won sign

The won sign (₩) is a currency symbol that represents:

South Korean won

North Korean won

(Unofficially) old Korean wonAnd in fiction:

Woolong, a fictional currency in Cowboy Bebop and Space Dandy

Kinzcash, a fictional form of currency in the online game Webkinz

Yen sign

The yen

or yuan sign (¥) is a currency sign used by the Japanese yen and the Chinese yuan currencies. This monetary symbol resembles a Latin letter Y with a single or double horizontal stroke. The symbol is usually placed before the value it represents, for example ¥50, unlike the kanji/Chinese character, which is more commonly used in Japanese and Chinese and is written following the amount: 50円 in Japan and 50元 in China.

This page is based on a Wikipedia article written by authors (here).
Text is available under the CC BY-SA 3.0 license; additional terms may apply.
Images, videos and audio are available under their respective licenses.