ArticleslgStudy

science

Stropping (syntax)

Stropping (syntax) is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Stropping (syntax) rather than just read about it. In short: 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. Stropping is not used in most modern languages – instead, keywords are reserved words and cannot be used as identifie…

Key takeaways

  • Stropping (syntax) belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Stropping (syntax) to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Stropping (syntax) from memory before moving on to harder problems.

Reference excerpt

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. Stropping is not used in most modern languages – instead, keywords are reserved words and cannot be used as identifiers. Stropping allows the same letter sequence to be used both as a keyword and as an identifier, and simplifies parsing in that case – for example allowing a variable named if without clashing with the keyword if. Stropping is primarily associated with ALGOL and related languages in the 1960s. Though it finds some modern use, it is easily confused with other similar techniques that are superficially similar.

History 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. The term "stropping" arose in ALGOL 60, from "apostrophe", as some implementations of ALGOL 60 used apostrophes around text to indicate boldface, such as 'if' to represent the keyword if. Stropping is also important in ALGOL 68, where multiple methods of stropping, known as "stropping regimes", are used; the original matched apostrophes from ALGOL 60 was not widely used, with a leading period or uppercase being more common, as in .IF or IF and the term "stropping" was applied to all of these.

Syntaxes A range of different syntaxes for stropping have been used:

ALGOL 60 commonly used only the convention of single quotes around the word, generally as apostrophes, whence the name "stropping" (e.g. 'BEGIN'). ALGOL 68 in some implementations treat letter sequences prefixed by a single quote, ', as being keywords (e.g., 'BEGIN) In fact it was often the case that several stropping conventions might be in use within one language. 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:

POINT for 6-bit (not enough characters for lowercase), as in .FOR – a similar convention is used in FORTRAN 77, where LOGICAL keywords are stropped as .EQ. etc. (see below) UPPER for 7-bit, as in FOR – with lowercase used for ordinary identifiers QUOTE as in ALGOL 60, as in 'for' RES reserved words, as used in modern languages – for is reserved and not available to ordinary identifiers 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. Other examples:

Atlas Autocode had the choice of three: keywords could be underlined using backspace and overstrike on a Flexowriter keyboard, they could be introduced by a %percent %symbol, or they could be typed in UPPER CASE with no delimiting character ("uppercasedelimiters" mode, in which case all variables had to be in lower case). ALGOL 60 on the Elliott 803 and Elliott 503 computers used underlining. The Flexowriters (producing punched paper tape) had a non-movement key (underline _) so that typing _b_e_g_i_n produced begin which was very readable. The vertical bar | was also a non-movement key so that typing |= produced a good approximation to ≠. The Kidsgrove compiler for ALGOL 60 on the English Electric KDF9 appears to have used at least two other stropping conventions in addition to quotation marks: exclamation marks and percent characters. ALGOL 68RS programs are allowed the use of several stropping variants, even within the one language processor. Edinburgh IMP inherited the Atlas Autocode %percent %symbol prefix convention but not its other stropping options

Examples of different ALGOL 68 styles Note the leading pr (abbreviation of pragmat) directive, which is itself stropped in POINT or quote style, and the ¢ for comment (from "2¢") – see ALGOL 68: pr & co: Pragmats and Comments for details.

Other languages For various reasons Fortran 77 has these "logical" values and operators: .TRUE., .FALSE., .EQ., .NE., .LT., .LE., .GT., .GE., .EQV., .NEQV., .OR., .AND., .NOT. .AND., .OR. and .XOR. are also used in combined tests in IF and IFF statements in batch files run under JP Software's command line processors like 4DOS, 4OS2, and 4NT / Take Command.

Modern use

To indicate identifiers Most modern computer languages do not use stropping. However, some languages support optional stropping to specify identifiers that would otherwise collide with reserved words or which contain non-alphanumeric characters. For example, the use of many languages in Microsoft's .NET Common Language Infrastructure (CLI) requires a way to use variables in a different language that may be keywords in a calling language. This is sometimes done by prefixes, such as @ in C#, or enclosing the identifier in brackets, in Visual Basic.NET. A second major example is in many implementations of Structured Query Language. 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,, Scala, and Kotlin, a reserved word or non-alphanumeric name can be used as an identifier by enclosing it in backticks. There are other, more minor examples. For example, Web IDL uses a leading underscore _ to strop identifiers that otherwise collide with reserved words: the value of the identifier strips this leading underscore, making this stropping, rather than a naming convention.

Unstropping by the compiler

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Stropping (syntax)

Start with the simplest possible case. Write down what Stropping (syntax) claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Stropping (syntax) before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Stropping (syntax) ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Stropping (syntax)

In research
Stropping (syntax) appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Stropping (syntax) in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Stropping (syntax) is common in secondary-school and first-year university syllabi. It links to neighbouring topics Parsing, so understanding it makes those chapters shorter.
In everyday life
Look for Stropping (syntax) outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Stropping (syntax) in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Stropping (syntax) means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Stropping (syntax) out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Stropping (syntax) in simple terms?

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 clashe…

Why does Stropping (syntax) matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Stropping (syntax)?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Stropping (syntax).

Tags

  • Parsing

Keep exploring