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`
ParseChainLeft
​
ParseChainLeft
[p,op]
returns the
ParserCombinator
that parses a left-associative chain of operands p joined by the binary-operator parser op, folding the operands leftward so that
1-2-3
groups as
(1-2)-3
.
​
Details and Options
▪
op returns its combining function. op matches an operator token and yields a binary function, applied as
f[left,right]
— the same op-returns-a-function convention as
ParseOperatorTable
. Attach it with
ParseAction
:
ParseAction[ParseLiteral["-"],(Subtract&)]
.
▪
Left-associative fold. Operands accumulate left to right:
poppopp
becomes
f[f[f[p1,p2],p3],p4]
. For
Subtract
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
ParseChoice
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.
ParseChainLeft
handles a single operator precedence. For several levels, or for prefix / postfix operators, use
ParseOperatorTable
— its one-
"InfixL"
-operator table is exactly this combinator, in one linear pass.
▪
Result type: whatever op's function returns, not necessarily a list.
​
Examples  
(13)
Basic Examples  
(3)
Left-associative subtraction — the chain
1-2-3
folds as
(1-2)-3
:
In[1]:=
num=
ParseAction

ParseCharacter
[DigitCharacter],FromDigits;​​sub=
ParseAction

ParseLiteral
["-"],(Subtract&);​​
Parse

ParseChainLeft
[num,sub],"1-2-3"
Out[1]=
-4
​
A single operand, with no operator, returns the operand itself — not
{5}
and not
f[5]
:
In[1]:=
Parse

ParseChainLeft
[num,sub],"5"
Out[1]=
5
​
A longer additive chain, with an operator that returns
Plus
:
In[1]:=
plus=
ParseAction

ParseLiteral
["+"],(Plus&);​​
Parse

ParseChainLeft
[num,plus],"1+2+3+4"
Out[1]=
10
Scope  
(4)

Properties & Relations  
(3)

Possible Issues  
(2)

Neat Examples  
(1)

SeeAlso
ParseChainRight
 
▪
ParseOperatorTable
 
▪
ParseSepBy
 
▪
ParseAction
 
▪
ParserCombinator
 
▪
Fold
RelatedGuides
▪
Parsing in the Wolfram Language
""

© 2026 Wolfram. All rights reserved.

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