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

Parser

Tutorials

  • Building Language Front-Ends
  • Inside CodeAnalysis - How CodeStructure Parses C
  • Design and Compilation Strategy
  • Implementing the LaTeX Math Parser
  • MaTeX Comparison Showcase
  • The Parser Landscape - a Survey of What Exists Today
  • The Parser Zoo - language front-ends over a shared algebra
  • Parsing BNF Grammars (and bootstrapping a TPTP parser)
  • Parsing GrammarRules Locally
  • A Markdown Inline Parser in Parser Combinators
  • ParsingOpenQASM
  • Parsing TPTP, Auto-Generated from the Published BNF
  • PrattVsPEG
  • The Wolfram Box Typesetting Reference

Guides

  • Parsing in the Wolfram Language

Symbols

  • ASTAddSource
  • ASTAlgebra
  • ASTContainer
  • ASTLeafQ
  • ASTNodeQ
  • ASTStripSource
  • BinaryNode
  • BrainfuckAST
  • BrainfuckGrammar
  • BrainfuckRun
  • BrainfuckSemantic
  • CalculatorAST
  • CalculatorEval
  • CalculatorGrammar
  • CalculatorSemantic
  • CallNode
  • ContainerNode
  • EBNFParse
  • EBNFRules
  • ErrorNode
  • ExportLaTeX
  • GroupNode
  • InfixNode
  • JSONAST
  • JSONGrammar
  • JSONImport
  • JSONSemantic
  • LambdaAST
  • LambdaEval
  • LambdaGrammar
  • LambdaSemantic
  • LaTeXMathParse
  • LaTeXMathParser
  • LaTeXMathStyle
  • LeafNode
  • LispAST
  • LispGrammar
  • LispRead
  • LispSemantic
  • LispSymbol
  • MarkdownInlineParse
  • MarkdownInlineParser
  • MarkdownParse
  • MarkdownParser
  • ParseAction
  • ParseBetween
  • ParseChainLeft
  • ParseChainRight
  • ParseCharacter
  • ParseChoiceLongest
  • ParseChoice
  • ParseFail
  • ParseLiteral
  • ParseLookahead
  • ParseMany
  • Parse
  • ParseNotFollowedBy
  • ParseOperatorTable
  • ParseOptional
  • ParsePartial
  • ParsePosition
  • ParserCombinator
  • ParserCombinatorQ
  • ParserCompile
  • ParseRecursive
  • ParseRegex
  • ParseSepBy1
  • ParseSepBy
  • ParseSequence
  • ParseSome
  • ParseSucceed
  • ParseTry
  • PostfixNode
  • PrefixNode
  • RecCell
  • RecRef
  • SetRec
  • SpannedToken
  • TernaryNode
  • ToCodeParser
  • TPTPExport
  • TPTPImport

Overviews

  • WolframParser
Wolfram`Parser`
ParserCompile
​
ParserCompile
[parser]
compiles
parser
(a
ParserCombinator
or a
GrammarRules
declaration) to native code via
FunctionCompile
, returning a
ParserCombinator
with a
CompiledCodeFunction
stored under the
"Code"
key of its options.
​
​
ParserCompile
[parser,
Method
"PEGVM"]
uses the PEG-VM backend instead of
FunctionCompile
: the grammar is lowered to an integer instruction table run on a single, once-compiled LPEG-style parsing machine. This scales to large recursive grammars (LaTeX math, TPTP) that
FunctionCompile
cannot compile in practical time, and runs 1-2 orders of magnitude faster than the interpreter. See Possible Issues.
​
​
ParserCompile
[parser,opts]
also accepts
"Memoize"True|False
(default
False
),
"InputType""UTF8String"|"TokenList"|"ExpressionList"
(default inferred from the grammar).
​
Details and Options
▪
Two backends.
MethodAutomatic
(default) lowers the combinator tree to a single
FunctionCompile
'd function - fast for small/medium grammars; recursive grammars need
"Recursive"True
and otherwise stay interpretive.
Method"PEGVM"
lowers the grammar to a flat integer instruction table interpreted by one native parsing machine (compiled once, shared by every grammar). Because the grammar is data, not code, the PEG-VM "compiles" any grammar of any size in milliseconds-to-seconds of plain Wolfram Language - no per-grammar
FunctionCompile
- and handles arbitrary recursion via an explicit stack. Captures recorded during the native run are replayed by a Wolfram post-pass to rebuild the exact result (same actions as
Parse
).
▪
ParserCompile
is the local analogue of cloud-deploying a
GrammarRules
: both turn a grammar declaration into a deployable callable, one ships it to the cloud, the other ships it through
FunctionCompile
into the local kernel.
▪
The result is a
ParserCombinator
of the same head as the input, with the compiled function folded into the options as
"Code"CompiledCodeFunction[...]
. No separate
"Compiled"True
flag - the presence of
"Code"
is the marker.
▪
A compiled
ParserCombinator
is callable as a function via the
SubValues
rule the wrapper carries:
compiled[input]
equals
Parse[compiled,input]
. Both end up invoking the cached compiled function rather than the interpreter.
▪
The compile cost is paid once per grammar; reuse the returned object across many
[input]
calls.
​
Examples  
(6)
Basic Examples  
(1)
Compile a literal parser:
In[1]:=
ParserCompile

ParseLiteral
["foo"]
Out[1]=
ParserCombinator
Type: Literal
Arity: 1
Compiled: True

The compiled object is callable directly via its SubValue:
In[2]:=
parser=
ParserCompile

ParseLiteral
["foo"];​​parser["foo"]
Out[2]=
foo
Scope  
(1)

Properties & Relations  
(1)

Possible Issues  
(2)

Neat Examples  
(1)

SeeAlso
Parse
 
▪
ParserCombinator
 
▪
FunctionCompile
 
▪
CloudDeploy
 
▪
GrammarRules
RelatedGuides
▪
Parsing in the Wolfram Language
""

© 2026 Wolfram. All rights reserved.

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