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:

Introduced in 2014
 (10.0)