Wolfram Language Paclet Repository

Community-contributed installable additions to the Wolfram Language

Primary Navigation

    • Cloud & Deployment
    • Core Language & Structure
    • Data Manipulation & Analysis
    • Engineering Data & Computation
    • External Interfaces & Connections
    • Financial Data & Computation
    • Geographic Data & Computation
    • Geometry
    • Graphs & Networks
    • Higher Mathematical Computation
    • Images
    • Knowledge Representation & Natural Language
    • Machine Learning
    • Notebook Documents & Presentation
    • Scientific and Medical Data & Computation
    • Social, Cultural & Linguistic Data
    • Strings & Text
    • Symbolic & Numeric Computation
    • System Operation & Setup
    • Time-Related Computation
    • User Interface Construction
    • Visualization & Graphics
    • Random Paclet
    • Alphabetical List
  • Using Paclets
    • Get Started
    • Download Definition Notebook
  • Learn More about Wolfram Language

PatternMatcher

Guides

  • A Virtual Machine for the Pattern Matcher

Symbols

  • CompilePatternToBytecode
  • CreatePatternMatcherVirtualMachine
  • PatternBytecodeDisassemble
  • PatternBytecodeInformation
  • PatternBytecode
  • PatternBytecodeQ
  • PatternMatcherEnableTrace
  • PatternMatcherExecute
  • PatternMatcherMatch
  • PatternMatcherMatchQ
  • PatternMatcherReplace
  • PatternMatcherStep
  • PatternMatcherTraceEnabled
  • PatternMatcherTraceEnabledQ
  • PatternMatcherVirtualMachine
  • PatternToMatchFunction
DanielS`PatternMatcher`
PatternBytecode
​
PatternBytecode
[…]
represents compiled bytecode for a Wolfram Language pattern.
​
Details and Options
Examples  
(6)
Basic Examples  
(1)
Create a
PatternBytecode
object:
In[1]:=
bc=
CompilePatternToBytecode
[x_Integer]
Out[1]=
PatternBytecode
Pattern:
x_Integer
Expr registers count: 2
Bool registers count: 1
Instruction count: 12

Access the original pattern:
In[2]:=
bc["getPattern"]["toHeldExpr"]
Out[2]=
HoldComplete[x_Integer]
Get a human-readable form of the bytecode:
In[3]:=
PatternBytecodeDisassemble
[bc]
Out[3]=
L0:​
0 BEGIN_BLOCK Label[0]​
1 MATCH_HEAD %e0​, Expr[Integer]​, Label[3]​
2 MOVE %e1​, %e0​
3 BIND_VAR Symbol[Global`x]​, %e1​
4 JUMP Label[2] → L2
​L3:​
5 JUMP Label[1] → L1
​L4:​
6 END_BLOCK Label[0]​
​L1:​
7 LOAD_IMM %b0​, 0
8 HALT
​L2:​
9 EXPORT_BINDINGS
10 LOAD_IMM %b0​, 1
11 HALT
​
​========================================​
​Statistics:​
Instructions: 12
Labels: 5
Expr registers: 2
Bool registers: 1
Blocks: 1 (max depth: 1)​
Jumps: 2
Backtrack points: 0
​
​Lexical bindings:​
Global`x → %e1​
Use the compiled bytecode to match expressions:
In[4]:=
PatternMatcherMatchQ
[bc]/@{4,4.2,"hello"}
Out[4]=
{True,False,False}
Scope  
(1)

Properties & Relations  
(4)

SeeAlso
CompilePatternToBytecode
 
▪
PatternMatcherExecute
 
▪
PatternMatcherMatchQ
 
▪
PatternMatcherReplace
 
▪
PatternBytecodeDisassemble
 
▪
PatternBytecodeInformation
RelatedGuides
▪
A Virtual Machine for the Pattern Matcher
""

© 2026 Wolfram. All rights reserved.

  • Legal & Privacy Policy
  • Contact Us
  • WolframAlpha.com
  • WolframCloud.com