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`Brainfuck`
BrainfuckSemantic
​
BrainfuckSemantic
is the algebra - an
Association
of builder functions - that compiles a Brainfuck parse to an executable machine -> machine closure.
​
Details and Options
▪
BrainfuckSemantic
is one of the two algebras the Brainfuck grammar runs over. It is the meaningful, executable one: each builder turns a parsed construct into a function machine -> machine, so the whole parse compiles to a closure that runs the program. The neutral alternative builds a standard syntax tree instead, surfaced through
BrainfuckAST
.
▪
It is a plain
Association
with three keys:
"Op"
,
"Seq"
, and
"Loop"
.
BrainfuckGrammar
's semantic actions look up these keys, so the algebra is the language's meaning - swap it and the same grammar means something else.
▪
"Op"
compiles one command token to a machine -> machine
Function
:
>
<
move the cell pointer,
+
-
change the current cell (taken
Mod
256
),
.
appends the cell to the output, and
,
consumes one input byte (or writes
0
when input is exhausted).
▪
"Seq"
composes a list of command machines with
RightComposition
- run left to right.
"Loop"
wraps a body in a
NestWhile
: the body runs while the current cell is nonzero.
▪
BrainfuckRun
is just
BrainfuckGrammar
[BrainfuckSemantic]
packaged as a function: it threads a fresh machine through the compiled closure and decodes the collected output bytes. To get the standard tree for the same grammar, use
BrainfuckAST
instead.
​
Examples  
(4)
Basic Examples  
(1)
The algebra is an
Association
of builder functions, keyed by construct:
In[1]:=
Keys
BrainfuckSemantic

Out[1]=
{Op,Seq,Loop}
The
"Op"
builder compiles one command to a machine -> machine
Function
:
In[2]:=
Head
BrainfuckSemantic
["Op"]["+"]
Out[2]=
Function
Apply that machine to a fresh state:
+
increments the current cell from
0
to
1
:
In[3]:=
Lookup
BrainfuckSemantic
["Op"]["+"]["tape","ptr"0,"in"{},"out"{}]["tape"],0
Out[3]=
1
The
>
command moves the cell pointer one step right:
In[4]:=
BrainfuckSemantic
["Op"][">"]["tape","ptr"0,"in"{},"out"{}]["ptr"]
Out[4]=
1
Scope  
(1)

Properties & Relations  
(1)

Neat Examples  
(1)

SeeAlso
BrainfuckRun
 
▪
BrainfuckGrammar
 
▪
BrainfuckAST
 
▪
RightComposition
 
▪
NestWhile
RelatedGuides
▪
ParserZoo
""

© 2026 Wolfram. All rights reserved.

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