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`
ASTAlgebra
​
ASTAlgebra
is the
Association
of builder functions that emit the standard AST nodes. A grammar written over an algebra - an
Association
its semantic actions call - produces a standard syntax tree when handed
ASTAlgebra
.
​
Details and Options
▪
An algebra is the indirection at the heart of the parser zoo: a grammar builder takes an algebra alg and its actions call
alg["Binary"][op,l,r]
,
alg["Leaf"][kind,src]
, and so on, never naming a node head directly. Feed the grammar
ASTAlgebra
and it builds a standard tree; feed it the language's own semantic algebra and the same grammar yields a meaningful value. The grammar is untouched; only the algebra is swapped.
▪
The keys are the node constructors:
"Leaf"
,
"Prefix"
,
"Postfix"
,
"Binary"
,
"Infix"
,
"Ternary"
,
"Call"
,
"Group"
,
"Container"
. Each maps to a function that returns the matching node with empty

metadata.
▪
The standard nodes mirror Wolfram's own
CodeParser
shape - a 3-slot
Head[descriptor,children,meta]
triple - but operator descriptors stay language-native strings (
"+"
,
":"
,
"'"
) rather than being forced into Wolfram symbols.
ToCodeParser
projects a neutral tree onto
CodeParser
-exact nodes when that is wanted.
▪
Extend it for language-specific constructs that map onto a standard node:
ASTAlgebra,"Object"(GroupNode["Object",#,]&)
.
▪
ASTAlgebra
is the bare builder: each function emits a node with empty

metadata and no
Source
. Source positions are added afterwards -
SpannedToken
captures a leaf's character span at parse time, and
ASTAddSource
spans the composites and converts to
{{line,col},{line,col}}
. A language entry point like
CalculatorAST
wires both in, so its output carries
Source
; the algebra builders called in isolation do not.
​
Examples  
(3)
Basic Examples  
(1)
The
"Binary"
builder makes a
BinaryNode
from an operator descriptor and two children:
In[1]:=
ASTAlgebra
["Binary"]"+",
LeafNode
["Integer","1",],
LeafNode
["Integer","2",]
Out[1]=
BinaryNode[+,{LeafNode[Integer,1,],LeafNode[Integer,2,]},]
The
"Leaf"
builder makes a terminal from a kind descriptor and the matched source text:
In[2]:=
ASTAlgebra
["Leaf"]["Integer","42"]
Out[2]=
LeafNode[Integer,42,]
The nine builder keys:
In[3]:=
Keys
ASTAlgebra

Out[3]=
{Leaf,Prefix,Postfix,Binary,Infix,Ternary,Call,Group,Container}
Scope  
(1)

Properties & Relations  
(1)

SeeAlso
ASTContainer
 
▪
ASTNodeQ
 
▪
ASTLeafQ
 
▪
ToCodeParser
 
▪
SpannedToken
 
▪
ASTAddSource
 
▪
BinaryNode
 
▪
LeafNode
RelatedGuides
▪
ParserZoo
""

© 2026 Wolfram. All rights reserved.

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