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`
ToCodeParser
​
ToCodeParser
[tree]
best-effort projects a neutral node tree onto
CodeParser
-exact nodes.
​
​
ToCodeParser
[tree,opmap]
additionally maps each operator descriptor to a Wolfram symbol through the
Association
opmap.
​
Details and Options
▪
The standard AST nodes share
CodeParser
's 3-slot shape but keep operator descriptors as language-native strings (
"+"
, not
Plus
).
ToCodeParser
rewrites a tree into the
CodeParser
-namespaced heads so it can flow into tools that expect real
CodeParser
output.
▪
The operator-bearing nodes (
BinaryNode
,
InfixNode
,
PrefixNode
,
PostfixNode
,
TernaryNode
) all become a
CodeParser
CallNode` headed by a symbol leaf; the descriptor is looked up in opmap, defaulting to the descriptor string itself when absent.
▪
A
LeafNode
kind string is mapped to a Wolfram symbol where there is an obvious one:
"Integer"Integer
,
"Real"Real
,
"String"String
,
"Symbol"Symbol
,
"Rational"Rational
; any other kind becomes
Symbol
.
▪
A
GroupNode
becomes a
CallNode
headed by a symbol leaf carrying the group kind; a
ContainerNode
becomes a
CodeParser
ContainerNode`; a
CallNode
keeps its head and arguments.
▪
It is best-effort: the projection is structural, so an unmapped operator stays a string leaf. Metadata is carried through untouched - when the input tree already has
Source{{line,col},{line,col}}
(as a
CalculatorAST
or
LispAST
tree does, via
SpannedToken
and
ASTAddSource
), the projected
CodeParser
-nodes keep it; a literally-built node with

projects to

.
​
Examples  
(3)
Basic Examples  
(1)
A neutral
CalculatorAST
tree projects onto
CodeParser
's shape; the opmap turns
"+"
into a real
Plus
, and the
Source
spans the grammar stamped on each node carry through:
In[1]:=
ToCodeParser

CalculatorAST
["1+2"],"+"Plus
Out[1]=
CodeParser`ContainerNode[String,{CodeParser`CallNode[CodeParser`LeafNode[Symbol,Plus,],{CodeParser`LeafNode[Integer,1,Source{{1,1},{1,2}}],CodeParser`LeafNode[Integer,2,Source{{1,3},{1,4}}]},Source{{1,1},{1,4}}]},Source{{1,1},{1,4}}]
A
BinaryNode
becomes a
CodeParser
CallNode` headed by the mapped symbol:
In[2]:=
ToCodeParser

BinaryNode
"+",
LeafNode
["Integer","1",],
LeafNode
["Integer","2",],,"+"Plus
Out[2]=
CodeParser`CallNode[CodeParser`LeafNode[Symbol,Plus,],{CodeParser`LeafNode[Integer,1,],CodeParser`LeafNode[Integer,2,]},]
A
LeafNode
kind string is mapped to the matching Wolfram symbol:
In[3]:=
ToCodeParser

LeafNode
["Integer","1",]
Out[3]=
CodeParser`LeafNode[Integer,1,]
Scope  
(1)

Properties & Relations  
(1)

SeeAlso
ASTAlgebra
 
▪
ASTContainer
 
▪
ASTAddSource
 
▪
CalculatorAST
 
▪
LeafNode
 
▪
ContainerNode
RelatedGuides
▪
ParserZoo
""

© 2026 Wolfram. All rights reserved.

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