Wolfram Language
Paclet Repository
Community-contributed installable additions to the Wolfram Language
Primary Navigation
Categories
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
Create a Paclet
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`
E
r
r
o
r
N
o
d
e
E
r
r
o
r
N
o
d
e
[
k
i
n
d
,
s
o
u
r
c
e
,
m
e
t
a
]
i
s
a
s
y
n
t
a
x
-
e
r
r
o
r
t
o
k
e
n
:
k
i
n
d
i
s
a
d
e
s
c
r
i
p
t
o
r
s
t
r
i
n
g
n
a
m
i
n
g
t
h
e
e
r
r
o
r
,
s
o
u
r
c
e
i
s
t
h
e
o
f
f
e
n
d
i
n
g
t
e
x
t
,
a
n
d
m
e
t
a
i
s
a
m
e
t
a
d
a
t
a
a
s
s
o
c
i
a
t
i
o
n
.
D
e
t
a
i
l
s
a
n
d
O
p
t
i
o
n
s
▪
E
r
r
o
r
N
o
d
e
is inert data: it carries no
D
o
w
n
V
a
l
u
e
s
, so building one just holds the three arguments. It mirrors
C
o
d
e
P
a
r
s
e
r
s
o
w
n
CodeParser
`
E
r
r
o
r
N
o
d
e
, the marker an error-recovering parser leaves in place of a malformed token.
▪
It has the same three-slot shape as a
L
e
a
f
N
o
d
e
-
kind
descriptor,
source
text,
meta
- but flags a syntax error rather than a valid terminal, so a tree carrying an
E
r
r
o
r
N
o
d
e
is still well-shaped and inspectable.
▪
E
r
r
o
r
N
o
d
e
is part of the standard vocabulary, but the five sample grammars do not do error recovery: a malformed input returns a
F
a
i
l
u
r
e
from
P
a
r
s
e
(reporting position, expected set and what was found) rather than producing a tree with an embedded
E
r
r
o
r
N
o
d
e
. The examples below build the node literally to show its shape.
▪
meta
holds a
"
S
o
u
r
c
e
"
position when the node comes from a real parse, and is an empty
when you build it by hand - as in every example here.
Examples
(
2
)
Basic Examples
(
1
)
An error node built literally holds its error descriptor and the offending source text:
I
n
[
1
]
:
=
E
r
r
o
r
N
o
d
e
[
"
U
n
t
e
r
m
i
n
a
t
e
d
S
t
r
i
n
g
"
,
"
\
"
a
b
c
"
,
]
O
u
t
[
1
]
=
E
r
r
o
r
N
o
d
e
[
U
n
t
e
r
m
i
n
a
t
e
d
S
t
r
i
n
g
,
"
a
b
c
,
]
An
E
r
r
o
r
N
o
d
e
answers
A
S
T
N
o
d
e
Q
with
T
r
u
e
, so an error-recovering tree stays a valid AST:
I
n
[
2
]
:
=
A
S
T
N
o
d
e
Q
E
r
r
o
r
N
o
d
e
[
"
U
n
t
e
r
m
i
n
a
t
e
d
S
t
r
i
n
g
"
,
"
\
"
a
b
c
"
,
]
O
u
t
[
2
]
=
T
r
u
e
P
r
o
p
e
r
t
i
e
s
&
R
e
l
a
t
i
o
n
s
(
1
)
S
e
e
A
l
s
o
L
e
a
f
N
o
d
e
▪
C
o
n
t
a
i
n
e
r
N
o
d
e
▪
A
S
T
N
o
d
e
Q
▪
T
o
C
o
d
e
P
a
r
s
e
r
▪
P
a
r
s
e
R
e
l
a
t
e
d
G
u
i
d
e
s
▪
P
a
r
s
e
r
Z
o
o
"
"