Define new semantax
semantax

The "semantax" pragma is used to define a new semantax as part of building a new vocabulary.
Syntax
The syntax for the semantax
pragma consists of:
- An exclamation point !
- The keyword semantax
- A
vocabulary
attribute, specified using a full-stop . followed by an arbitrary namespace. - A
semantax
attribute, specified using a hashtag # followed by the mnemonic being defined as the new semantax. - A
phrase type
attribute, specified as either*standard
or*inline
. - A
parents
attribute (optional), being a space-separated list of the semantax which are allowed to be containers for this new semantax. - An
implied
attribute (optional), identifying the name of another semantax which is to be treated as the default implied semantax. - A
container
attribute (optional) which specifies that the new semantax may have subordinates. - A
self-closing
attribute (optional) which specifies that the new semantax may not contain compositional text.
The *standard
attribute is used to define a new semantax that follows the basic phrasing pattern. The *inline
attribute is used to define a new semantax that follows the term phrasing pattern.
The parents
, implied
, container
and self-closing
attributes provide clues to the BLUEPROCESSOR to correctly compile manuscripts even when the author makes syntax mistakes.
!semantax .vocabulary #semantax *standard *inline *parents='semantax semantax' *implied=semantax *container *self-closing
Examples
Here is what the semantax
pragmas looks like for defining a vcard vocabulary.
!blue 2.0
!semantax .vcard #vcard
!semantax .vcard #n *parents=vcard
!semantax .vcard #photo *parents=vcard
!semantax .vcard #tel *parents=vcard
!semantax .vcard #surname *parents=n
!semantax .vcard #given *parents=n
!semantax .vcard #prefix *parents=n
!semantax .vcard #uri *parents='photo tel'
!semantax .vcard #parameters *parents='photo tel'
!semantax .vcard #mediatype *parents=parameters *implied=text
!semantax .vcard #type *parents=parameters *implied=text
!semantax .vcard #text *parents='mediatype type'
vcard.blue
And here is how the new vocabulary may be used:
!blue 2.0
!include `vcard.blue`
!option --vocabulary=vcard
vcard {
n {
surname Forrest
given Gump
prefix Mr.
}
photo {
parameters {
mediatype {
image/gif
}
}
uri http://www.gump.me/forrest.gif
}
tel {
parameters {
type {
mobile
}
}
uri tel:+1-111-555-1212
}
}