• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
      • Io
      • Defttag
      • Sys-call
      • Save-exec
      • Quicklisp
      • Oslib
      • Std/io
      • Bridge
      • Clex
        • Example-lexer
        • Sin
        • Matching-functions
          • Sin-match-until-lit
          • Sin-match-lit
          • Sin-match-charset*
          • Sin-match-some-lit
          • Sin-match-through-lit
          • Sin-match-everything
          • Def-match-thms
        • Def-sin-progress
      • Tshell
      • Unsound-eval
      • Hacker
      • Startup-banner
      • Command-line
    • Hardware-verification
    • Software-verification
    • Testing-utilities
    • Math
  • Clex

Matching-functions

Functions for matching text from the start of the input stream.

Matching functions are the main way of processing a string input stream sin. Each matching function can recognize and extract some particular kind of input from the start of the input stream. We say that some matchers are strong and some are weak:

Strong Matcher
On success, always matches at least some text.
Signature: (match-foo ... sin) → (mv match sin)
Examples: sin-match-lit, sin-match-charset*, ...
Weak Matcher
May succeed even without matching any text.
Signature: (match-foo ... sin) → (mv okp match sin)
Example: sin-match-until-lit

In either case, the match returned is either

  • nil, to indicate that no text is matched, or
  • a non-empty string with text extracted from the start of the stream,

and the resulting sin is the updated input stream: when no text was matched, sin is unchanged; otherwise it is advanced just past whatever text was matched.

Matching functions generally satisfy several basic properties that are described in def-match-thms.

Subtopics

Sin-match-until-lit
Match anything that occurs up until the first occurrence of a particular string literal.
Sin-match-lit
Match exactly some particular string literal.
Sin-match-charset*
Match all leading characters in some charset-p.
Sin-match-some-lit
Match any one of several string literals.
Sin-match-through-lit
Match anything that occurs up to, and including, the first occurrence of a particular string literal.
Sin-match-everything
Match everything that remains, no matter what it is.
Def-match-thms
Prove basic properties about a matching function.