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`
Parse
​
Parse
[parser,input]
runs a parser (a
ParserCombinator
or a
GrammarRules
declaration) against an input (a
String
, a
List
of tokens, or a
List
of Wolfram expressions). Returns the parse result on success, or a
Failure
object (tagged
"ParseError"
) on failure.
​
Details and Options
▪
Parse
requires the parser to consume the entire input. To accept a partial parse and get back the leftover, use
ParsePartial
.
▪
A
GrammarRules
declaration is lowered to a
ParserCombinator
(and JIT-compiled the first time it is seen) before being run; the lowering result is cached so a second
Parse[grammar,...]
call against the same grammar reuses the work.
▪
For a
ParserCombinator
without a
"Code"
entry in its options,
Parse
runs the interpretive path. For a parser already passed through
ParserCompile
,
Parse
invokes the compiled function directly. Either way,
parser[input]
and
Parse[parser,input]
are equivalent (
ParserCombinator
carries a SubValue rule that routes one to the other).
▪
On success the return value is the structured result the combinator built - usually a string, a list of children, or an action's return value.
▪
On failure the return value is a
Failure["ParseError","Position"_,"Expected"_,"Found"_,...]
association carrying the position of the furthest-advanced failure, the set of expected tokens at that position, and what was found instead.
​
Examples  
(5)
Basic Examples  
(1)
A literal parser matches when the input is exactly the literal:
In[1]:=
Parse

ParseLiteral
["foo"],"foo"
Out[1]=
foo
A digit parser:
In[2]:=
Parse

ParseCharacter
[DigitCharacter],"5"
Out[2]=
5
A sequence built with the
~~
operator:
In[3]:=
Parse

ParseLiteral
["foo"]~~
ParseLiteral
["bar"],"foobar"
Out[3]=
{foo,bar}
The same via the SubValue (
parser[input]
is
Parse[parser,input]
):
In[4]:=

ParseLiteral
["foo"]~~
ParseLiteral
["bar"]["foobar"]
Out[4]=
{foo,bar}
Scope  
(1)

Properties & Relations  
(1)

Possible Issues  
(1)

Neat Examples  
(1)

SeeAlso
ParserCompile
 
▪
ParserCombinator
 
▪
ParsePartial
 
▪
Interpreter
RelatedGuides
▪
Parsing in the Wolfram Language
""

© 2026 Wolfram. All rights reserved.

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