Skip to content

Latest commit

 

History

History
46 lines (38 loc) · 2.36 KB

sam.md

File metadata and controls

46 lines (38 loc) · 2.36 KB

sam

[src]

Author: Rob Pike

Introduced Pike VM [history vm, submatch]

From “Regular Expression Matching: the Virtual Machine Approach” by Russ Cox (2009):

In a “threaded” implementation like thompsonvm above, we simply add the saved pointer set to the thread state. Rob Pike first used this approach, in the text editor sam.

The most interesting technique in this article is the one of storing submatch information in the regular expression thread state. The earliest instance I know of this technique in a regular expression engine is in Rob Pike's sam editor, written around 1985. (The modifications to store submatches were contributed by Bruce Janson a couple of years after the original implementation.) The technique makes a cameo in a textbook in 1974 but then seems to get lost until its reappearance in sam.

Descendants

  • Plan 9 from User Space sam [src]: ported to Unix by Russ Cox
  • Plan 9 libregexp [src] [docs regexp(2), regexp(6)]
    • Plan 9 from User Space libregexp [src] [docs regexp(3), regexp(7)]: ported to Unix by Russ Cox
      • tylov/regexp9 [src]: fork with more modern features
    • 9legacy libregexp-fixes.diff [src]: patch by David du Colombier
    • Inferno libregexp [src] [docs regex(2), regexp(6)]: copied to Inferno
  • A library in Eighth Edition Unix [[history][rsc-history]]: extracted by Dave Presotto