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`
SetRec
​
SetRec
[cell,parser]
gives a recursion cell its parser, closing a recursive grammar's loop.
​
Details and Options
▪
A recursive grammar is built in two moves: allocate a cell with
RecCell
and reference it with
RecRef
while writing the productions, then call
SetRec
to bind the cell's symbol to the finished parser. Until
SetRec
runs, a
RecRef
points at an unset cell.
▪
SetRec
assigns the parser to the cell's underlying
Unique
symbol, where
ParseRecursive
looks it up at parse time. It returns the parser it was given, so it can stand as the last line of a builder.
▪
Make parser a
ParseChoice
of concrete alternatives rather than a production beginning with a nullable parser; re-entering at a nullable prefix can match empty and bail instead of recursing.
▪
Mutually-recursive productions each get their own cell; bind each with its own
SetRec
, in any order, since the references resolve lazily.
​
Examples  
(3)
Basic Examples  
(1)
Allocate a cell, write a nested-list production that refers to it through
RecRef
, and close the loop with
SetRec
:
In[1]:=
cell=
RecCell
[];​​list=
ParseBetween
​​
ParseLiteral
"["],​​
ParseSepBy

ParseChoice

ParseRegex
["[0-9]+"],
RecRef
[cell],
ParseLiteral
[","],​​
ParseLiteral
["]"​​;​​
SetRec
[cell,list];​​
Parse
[list,"[1,[2,3]]"]
Out[1]=
{1,{2,3}}
SetRec
returns the parser it was handed, so it composes as the tail of a grammar builder:
In[2]:=
SetRec

RecCell
[],
ParseLiteral
["x"]
Out[2]=
ParserCombinator
Type: Literal
Arity: 1
Compiled: False

Scope  
(1)

Possible Issues  
(1)

SeeAlso
RecCell
 
▪
RecRef
 
▪
ParseRecursive
 
▪
ParseChoice
 
▪
ParseBetween
RelatedGuides
▪
Parser Zoo
""

© 2026 Wolfram. All rights reserved.

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