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`
LeafNode
​
LeafNode
[kind,source,meta]
is a terminal node of the standard syntax tree, carrying the descriptor string kind, the matched text source, and a metadata association meta.
​
Details and Options
▪
LeafNode
is inert data: it carries no
DownValues
, so building one just holds the three arguments. It exists only to give parsed output a uniform, inspectable shape, mirroring
CodeParser
sown
CodeParser
`LeafNode
.
▪
kind is a language-native descriptor string such as
"Integer"
,
"Real"
,
"String"
,
"Symbol"
,
"Boolean"
,
"Null"
,
"Command"
or
"Token"
. It labels the terminal without committing to a Wolfram symbol.
▪
source is the literal matched text, kept verbatim: the integer one is
"1"
, not
1
, and a JSON string leaf keeps its surrounding quotes. A value is only interpreted in a language's evaluating mode (for example
CalculatorEval
).
▪
meta is an association of metadata. When the leaf comes from a real parse it holds a
"Source"
position
{{
line
,
col
},{
line
,
col
}}
spanning the matched text; a node you build by hand carries an empty

.
▪
Every zoo grammar emits leaves:
CalculatorAST
tags numbers
"Integer"
/
"Real"
and identifiers
"Symbol"
;
JSONAST
adds
"String"
,
"Boolean"
and
"Null"
;
BrainfuckAST
tags each of the eight commands
"Command"
;
LispAST
and
LambdaAST
use
"Symbol"
for identifiers.
​
Examples  
(2)
Basic Examples  
(1)
A leaf built literally holds its three slots unevaluated:
In[1]:=
LeafNode
["Integer","1",]
Out[1]=
LeafNode[Integer,1,]
A bare integer parses to a single
"Integer"
leaf inside the
ContainerNode
root:
In[2]:=
CalculatorAST
["42"]
Out[2]=
ContainerNode[String,{LeafNode[Integer,42,Source{{1,1},{1,3}}]},Source{{1,1},{1,3}}]
Each Brainfuck command is a
"Command"
leaf:
In[3]:=
BrainfuckAST
["+"]
Out[3]=
ContainerNode[String,{LeafNode[Command,+,Source{{1,1},{1,2}}]},Source{{1,1},{1,2}}]
Properties & Relations  
(1)

SeeAlso
CallNode
 
▪
GroupNode
 
▪
ContainerNode
 
▪
ASTNodeQ
 
▪
ToCodeParser
 
▪
ASTAlgebra
RelatedGuides
▪
ParserZoo
""

© 2026 Wolfram. All rights reserved.

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