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`
P
a
r
s
e
C
h
a
i
n
L
e
f
t
P
a
r
s
e
C
h
a
i
n
L
e
f
t
[
p
,
o
p
]
r
e
t
u
r
n
s
t
h
e
P
a
r
s
e
r
C
o
m
b
i
n
a
t
o
r
t
h
a
t
p
a
r
s
e
s
a
l
e
f
t
-
a
s
s
o
c
i
a
t
i
v
e
c
h
a
i
n
o
f
o
p
e
r
a
n
d
s
p
j
o
i
n
e
d
b
y
t
h
e
b
i
n
a
r
y
-
o
p
e
r
a
t
o
r
p
a
r
s
e
r
o
p
,
f
o
l
d
i
n
g
t
h
e
o
p
e
r
a
n
d
s
l
e
f
t
w
a
r
d
s
o
t
h
a
t
1
-
2
-
3
g
r
o
u
p
s
a
s
(
1
-
2
)
-
3
.
D
e
t
a
i
l
s
a
n
d
O
p
t
i
o
n
s
▪
op returns its combining function.
op
matches an operator token and yields a
binary
function, applied as
f
[
l
e
f
t
,
r
i
g
h
t
]
— the same op-returns-a-function convention as
P
a
r
s
e
O
p
e
r
a
t
o
r
T
a
b
l
e
. Attach it with
P
a
r
s
e
A
c
t
i
o
n
:
P
a
r
s
e
A
c
t
i
o
n
[
P
a
r
s
e
L
i
t
e
r
a
l
[
"
-
"
]
,
(
S
u
b
t
r
a
c
t
&
)
]
.
▪
Left-associative fold.
Operands accumulate left to right:
p
o
p
p
o
p
p
becomes
f
[
f
[
f
[
p
1
,
p
2
]
,
p
3
]
,
p
4
]
. For
S
u
b
t
r
a
c
t
this makes
1
-
2
-
3
evaluate as
(
1
-
2
)
-
3
.
▪
One or more operands.
At least one
p
is required, so empty input fails. A lone operand with no following operator returns that operand
itself
, not a one-element list.
▪
Mixed operators share the level.
When
op
is a
P
a
r
s
e
C
h
o
i
c
e
of several operator parsers, each returning its own function, they associate together left to right — for example
+
and
-
in one additive chain.
▪
One precedence level.
P
a
r
s
e
C
h
a
i
n
L
e
f
t
handles a single operator precedence. For several levels, or for prefix / postfix operators, use
P
a
r
s
e
O
p
e
r
a
t
o
r
T
a
b
l
e
— its one-
"
I
n
f
i
x
L
"
-operator table is exactly this combinator, in one linear pass.
▪
Result type: whatever
op
's function returns, not necessarily a list.
Examples
(
1
3
)
Basic Examples
(
3
)
Left-associative subtraction — the chain
1
-
2
-
3
folds as
(
1
-
2
)
-
3
:
I
n
[
1
]
:
=
n
u
m
=
P
a
r
s
e
A
c
t
i
o
n
P
a
r
s
e
C
h
a
r
a
c
t
e
r
[
D
i
g
i
t
C
h
a
r
a
c
t
e
r
]
,
F
r
o
m
D
i
g
i
t
s
;
s
u
b
=
P
a
r
s
e
A
c
t
i
o
n
P
a
r
s
e
L
i
t
e
r
a
l
[
"
-
"
]
,
(
S
u
b
t
r
a
c
t
&
)
;
P
a
r
s
e
P
a
r
s
e
C
h
a
i
n
L
e
f
t
[
n
u
m
,
s
u
b
]
,
"
1
-
2
-
3
"
O
u
t
[
1
]
=
-
4
A single operand, with no operator, returns the operand itself — not
{
5
}
and not
f
[
5
]
:
I
n
[
1
]
:
=
P
a
r
s
e
P
a
r
s
e
C
h
a
i
n
L
e
f
t
[
n
u
m
,
s
u
b
]
,
"
5
"
O
u
t
[
1
]
=
5
A longer additive chain, with an operator that returns
P
l
u
s
:
I
n
[
1
]
:
=
p
l
u
s
=
P
a
r
s
e
A
c
t
i
o
n
P
a
r
s
e
L
i
t
e
r
a
l
[
"
+
"
]
,
(
P
l
u
s
&
)
;
P
a
r
s
e
P
a
r
s
e
C
h
a
i
n
L
e
f
t
[
n
u
m
,
p
l
u
s
]
,
"
1
+
2
+
3
+
4
"
O
u
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