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`Languages`Calculator`
CalculatorSemantic
​
CalculatorSemantic
is the algebra - an
Association
of builder functions - that folds the calculator parse to a numeric or symbolic Wolfram value.
​
Details and Options
▪
CalculatorSemantic
is one of the two algebras the calculator grammar runs over. It is the meaningful, language-specific one: each builder maps a parsed construct directly to its arithmetic value. The neutral alternative is
ASTAlgebra
, which builds a standard syntax tree instead.
▪
It is a plain
Association
with three keys:
"Leaf"
,
"Binary"
, and
"Prefix"
.
CalculatorGrammar
's semantic actions look up these keys, so the algebra is the language's meaning - swap it and the same grammar means something else.
▪
"Leaf"
turns matched source text into a value by kind: an
"Integer"
folds with
FromDigits
, a
"Real"
with
ToExpression
, and anything else (a
"Symbol"
) becomes the matching Wolfram
Symbol
.
▪
"Binary"
maps an operator descriptor to the matching Wolfram operation (
Plus
,
Subtract
,
Times
,
Divide
,
Power
);
"Prefix"
negates for
"-"
and is the identity otherwise.
▪
CalculatorEval
is just
CalculatorGrammar
[CalculatorSemantic]
packaged as a function. To get the standard tree for the same grammar, run it over
ASTAlgebra
instead.
​
Examples  
(4)
Basic Examples  
(1)
The algebra is an
Association
of builder functions, keyed by node role:
In[1]:=
Keys
CalculatorSemantic

Out[1]=
{Leaf,Binary,Prefix}
The
"Leaf"
builder interprets matched source text. An integer kind folds with
FromDigits
:
In[2]:=
CalculatorSemantic
["Leaf"]["Integer","42"]
Out[2]=
42
A
"Symbol"
leaf becomes the matching Wolfram
Symbol
, keeping the value open:
In[3]:=
CalculatorSemantic
["Leaf"]["Symbol","x"]
Out[3]=
x
The
"Binary"
builder maps an operator descriptor onto the Wolfram operation:
In[4]:=
CalculatorSemantic
["Binary"]["+",1,2]
Out[4]=
3
Scope  
(1)

Properties & Relations  
(1)

Neat Examples  
(1)

SeeAlso
CalculatorEval
 
▪
CalculatorGrammar
 
▪
CalculatorAST
 
▪
ASTAlgebra
 
▪
ParseOperatorTable
RelatedGuides
▪
ParserZoo
""

© 2026 Wolfram. All rights reserved.

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