In computer language design, stropping is a method of explicitly marking letter sequences as having a special property, such as being a keyword, or a certain type of variable or storage location, and thus inhabiting a different namespace from ordinary names ("identifiers"), in order to avoid clashes.
The method of stropping and the term "stropping" arose in the development of ALGOL in the 1960s, where it was used to represent typographical distinctions (boldface and underline) found in the publication language which could not directly be represented in the hardware language – a typewriter could have bold characters, but in encoding in punch cards, there were no bold characters.
For example, in ALGOL 68, the choice of stropping convention can be specified by a compiler directive (in ALGOL terminology, a "pragmat"), namely POINT, UPPER, QUOTE, or RES: The various rules regimes are a lexical specification for stropped characters, though in some cases these have simple interpretations: in the single apostrophe and dot regimes, the first character is functioning as an escape character, while in the matched apostrophes regime the apostrophes are functioning as delimiters, as in string literals.
However, some languages support optional stropping to specify identifiers that would otherwise collide with reserved words or which contain non-alphanumeric characters.
In those languages reserved words can be used as column, table, or variable names by lexically delimiting them.
The standard specifies enclosing reserved words in double quotes, but in practice the exact mechanism varies by implementation; MySQL, for example, allows reserved words to be used in other contexts by enclosing them in backticks, and Microsoft SQL Server uses square brackets.
In several languages, including Nim, R,[7] and Scala,[8] a reserved word or non-alphanumeric name can be used as an identifier by enclosing it in backticks.
In a compiler front end, unstropping originally occurred during an initial line reconstruction phase, which also eliminated whitespace.
A number of similar techniques exist, generally prefixing or suffixing an identifier to indicate different treatment, but the semantics are varied.
Using uppercase for keywords remains in use as a convention for writing grammars for lexing and parsing – tokenizing the reserved word if as the token class IF, and then representing an if-then-else clause by the phrase IF Expression THEN Statement ELSE Statement where uppercase terms are keywords and capitalized terms are nonterminal symbols in a production rule (terminal symbols are denoted by lowercase terms, such as identifier or integer, for an integer literal).
These solve the same problem of namespace clashes in a way that is the same for a programmer, but which differs in terms of formal grammar and implementation.