GrammarToken[form]

is a grammar rules pattern object that represents any input of the specified form.

Details

Examples

open allclose all

Basic Examples  (2)

Deploy a grammar that makes use of a built-in GrammarToken:

Apply the grammar to an input:

Deploy a grammar that defines and uses an "Appliance" token:

Apply the grammar to an input:

Scope  (1)

A custom GrammarToken can be used before and after its definition in the GrammarRules:

Applications  (1)

New tokens can be used to build up complicated expressions, e.g. to deploy a simple calculator:

Apply the calculator grammar and actions:

Properties & Relations  (1)

If a definition is given for a built-in GrammarToken, the given definition is used, not the built-in one:

Apply the new definition to an input string:

The replacement for GrammarToken["City"] prevents use of the usual one by this grammar:

Wolfram Research (2014), GrammarToken, Wolfram Language function, https://reference.wolfram.com/language/ref/GrammarToken.html.

Text

Wolfram Research (2014), GrammarToken, Wolfram Language function, https://reference.wolfram.com/language/ref/GrammarToken.html.

CMS

Wolfram Language. 2014. "GrammarToken." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/GrammarToken.html.

APA

Wolfram Language. (2014). GrammarToken. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/GrammarToken.html

BibTeX

@misc{reference.wolfram_2024_grammartoken, author="Wolfram Research", title="{GrammarToken}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/GrammarToken.html}", note=[Accessed: 04-October-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_grammartoken, organization={Wolfram Research}, title={GrammarToken}, year={2014}, url={https://reference.wolfram.com/language/ref/GrammarToken.html}, note=[Accessed: 04-October-2024 ]}