q2K BHP
Black History Portal
THE BHP WIRE —
HIDDEN TRUTHS
What's New!
THE JOURNEY THROUGH TIME

Explore Black History

Explore the people, places, events, achievements, struggles and stories that shaped our journey.

✊🏾

Civil Rights

Movements, leaders, victories and the continuing fight for equality.

⚙️

Black Inventors

Innovation, patents, science, technology and world-changing contributions.

🏆

Sports

Pioneers, champions, Negro Leagues, records, activism and excellence.

♟️

People

Meet the people whose lives, choices and achievements shaped the journey.

📍

Places

Black towns, communities, institutions and places where history happened.

📜

Events

Moments that changed communities, movements, institutions and the nation.

Enter a person, place, event, or topic.
MY'STORY

The MOVE Fire

This is a personal recollection on the Move fire on May 13, 1985 Philadelphia police fired thousands of rounds at the MOVE house, city officials approved dropping an explosive device on the roof, the resulting fire was allowed to burn, 11 people—including five children—died, and 61 homes were destroyed. Philadelphia City Council later called it a “brutal attack carried out by the City of Philadelphia on its own citizens” and acknowledged that no individual faced criminal consequences for the bombing. One timeline correction worth preserving for the BHP record: the major previous MOVE-police confrontation was August 8, 1978, about seven years before the bombing, not a year or two earlier. Officer James Ramp was killed, other police and firefighters were wounded, nine MOVE members were later convicted, and television cameras recorded police beating Delbert Africa during his arrest. The 1985 MOVE Commission later specifically criticized city planners for failing to adequately use lessons from that 1978 confrontation. And that actually strengthens the point you’re making: 1985 did not happen without precedent or institutional memory. There had already been a deadly confrontation with MOVE, years of conflict, negotiations and police involvement before Osage Avenue.

MORE →
BLACK FACTS
The Truths They Never Taught You...

Ruler of the Mali Empire in the 14th century

Mansa Musa was the ruler of the Mali Empire in West Africa. Details recorded here should be sourced; unknown information is left blank.

MORE →
BHP gathered finds from its connected research sources. Showing the 4 strongest Black History matches.
← BACK TO RESULTS
Wikipedia

Lexer hack

In computer programming, the lexer hack is a solution to parsing a context-sensitive grammar such as C, where classifying a sequence of characters as a variable name or a type name requires contextual information, by feeding contextual information backwards from the parser to the lexer.

The lexer hack is frowned upon in modern compilers as it creates tight coupling between otherwise largely independent steps in the compilation process. Instead, identifier-like tokens are tokenized as identifiers and later disambiguated by the parser, allowing cleaner separation of concerns.

Problem

[edit]

The fundamental problem is differentiating types from other identifiers. In the following example, the lexical class of A cannot be determined without further contextual information:

A * B;

This code could either be multiplication or a declaration, depending on context.

In more detail, in a compiler, the lexer performs one of the earliest stages of converting the source code to a program. It scans the text to extract meaningful tokens, such as words, numbers, and strings. The parser analyzes sequences of tokens attempting to match them to syntax rules representing language structures, such as loops and variable declarations. A problem occurs here if a single sequence of tokens can ambiguously match more than one syntax rule.

This ambiguity can happen in C if the lexer does not distinguish between variable and typedef identifiers.[1] For example, in the C expression:

A * B;

the lexer may find these tokens:

  1. ?? 'A'
  2. operator '*'
  3. identifier 'B'
  4. punctuation ';'

Depending on whether A is a typedef name or not it may be desirable to tokenize A as either an identifier or a type so the parser does not have to handle an ambiguous parse. This grammatical ambiguity is known as the "typedef-name: identifier" problem, due to the name of the problematic production rule.[2][3]

The hack solution

[edit]

The solution generally consists of feeding information from the semantic symbol table back into the lexer. That is, rather than functioning as a pure one-way pipeline from the lexer to the parser, there is a backchannel from semantic analysis back to the lexer. This mixing of parsing and semantic analysis is generally regarded as inelegant, which is why it is called a "hack".

Without added context, the lexer cannot distinguish type identifiers from other identifiers because all identifiers have the same format. With the hack in the above example, when the lexer finds the identifier A it should be able to classify the token as a type identifier. The rules of the language would be clarified by specifying that typecasts require a type identifier and the ambiguity disappears.

The problem also exists in C++ and parsers can use the same hack.[1]

Alternative solutions

[edit]

This problem does not arise (and hence needs no "hack" in order to solve) when using lexerless parsing techniques, as these are intrinsically contextual. These are generally seen as less elegant designs, however, because they lack the modularity of having a concurrent lexer and parser in a pipeline.[citation needed]

Some parser generators, such as the byacc-derived BtYacc ("Backtracking Yacc"), give the generated parser the ability to try multiple attempts to parse the tokens. In the problem described here, if an attempt fails because of semantic information about the identifier, it can backtrack and attempt other rules.[4]

The Clang parser handles the situation in a completely different way, namely by using a non-reference lexical grammar. Clang's lexer does not attempt to differentiate between type names and variable names: it simply reports the current token as an identifier. The parser then uses Clang's semantic analysis library to determine the nature of the identifier. This allows a simpler and more maintainable architecture than The Lexer Hack.[5] This is also the approach used in most other modern languages, which do not distinguish different classes of identifiers in the lexical grammar, but instead defer them to the parsing or semantic analysis phase, when sufficient information is available.[example needed]

See also

[edit]

References

[edit]
  1. ^ a b Roskind, James A. (1991-07-11). "A YACC-able C++ 2.1 GRAMMAR, AND THE RESULTING AMBIGUITIES". Archived from the original on 2007-06-22. Retrieved 2008-11-27.
  2. ^ Brian W. Kernighan and Dennis M. Ritchie (Apr 1988). "Appendix A". The C Programming Language. Prentice Hall Software Series (2nd ed.). Englewood Cliffs/NJ: Prentice Hall. p. 236. ISBN 0131103628.
  3. ^ Bendersky, Eli (2007-11-24). "The context sensitivity of C's grammar".
  4. ^ "BtYacc 3.0". Based on Berkeley yacc with modifications by Chris Dodd and Vadim Maslov.
  5. ^ Bendersky, Eli. "How Clang handles the type / variable name ambiguity of C/C++".

Citations

[edit]

Source: Wikipedia. Article content is retrieved live through the MediaWiki API.

Wikipedia

Persistent identifier

A persistent identifier (PI or PID) is a long-lasting identifier to a document, file, web page, or other object. The term "persistent identifier" is usually used in the context of digital objects that are accessible over the Internet. Typically, such an identifier is not only persistent but actionable: you can plug it into a web browser and be taken to the identified source. Of course, the issue of persistent identification predates the Internet. Over centuries, writers and scholars developed standards for citation of paper-based documents so that readers could reliably and efficiently find a source that a writer mentioned in a footnote or bibliography. After the Internet started to become an important source of information in the 1990s, the issue of citation standards became important in the online world as well. Studies have shown that within a few years of being cited, a significant percentage of web addresses go "dead", a process often called link rot. Using a persistent identifier can slow or stop this process. An important aspect of persistent identifiers is that "persistence is purely a matter of service". That means that persistent identifiers are only persistent to the degree that someone commits to resolving them for users. No identifier can be inherently persistent, however many persistent identifiers are created within institutionally administered systems with the aim to maximise longevity. However, some regular URLs (i.e. web addresses), maintained by the website owner, are intended to be long-lasting; these are often called permalinks.

MORE →
No preview image
Wikipedia

Lexer hack

In computer programming, the lexer hack is a solution to parsing a context-sensitive grammar such as C, where classifying a sequence of characters as a variable name or a type name requires contextual information, by feeding contextual information backwards from the parser to the lexer. The lexer hack is frowned upon in modern compilers as it creates tight coupling between otherwise largely independent steps in the compilation process. Instead, identifier-like tokens are tokenized as identifiers and later disambiguated by the parser, allowing cleaner separation of concerns.

MORE →
Wikipedia

Identifier

An identifier is a name that identifies (that is, labels the identity of) either a unique class of objects or a unique instance of such objects; the class or instance may be an idea, person, physical countable object (or class thereof), or physical noncountable substance (or class thereof). The abbreviation "ID" may refer to identity, identification (the process of identifying), or an identifier (that is, an instance of identification). An identifier may be a word, number, letter, symbol, or any combination of those. If the identifier follows an encoding system—wherein parts of the identifier stand for [represent] ideas or longer names—it is often referred to as a code or ID code. Identifiers that do not follow any encoding scheme are often said to be arbitrary IDs as they have no greater meaning. A unique identifier (UID) is an identifier that refers to only one instance—only one particular object in the universe. A part number is an identifier, but it is not a unique identifier—for that, a serial number would be needed, to identify each instance of the part design. For example, the identifier "Model T" identifies the class (or model) of automobiles that Ford's Model T comprises; whereas the unique identifier "Model T Serial Number 159,862" identifies one specific member of that class—that is, one particular Model T car, owned by one specific person.

MORE →
No preview image
Wikipedia

Disambiguation (disambiguation)

Disambiguation is the process of identifying which meaning of a word is used in context. Disambiguation may also refer to:

MORE →
TOPIC OF THE DAY

Greenwood / Black Wall Street

Before the 1921 destruction of Tulsa’s Greenwood District, Black residents had created a remarkable center of business and community life. The district included stores, professional offices, entertainment venues and homes owned by Black citizens. Understanding Greenwood means learning what was built—not only what was burned.

MORE →
TRIVIA QUESTION OF THE DAY

Who was the first African-American woman millionaire in the United States?

Madam C.J. Walker