8.15.0.12
1.2 Metavariables🔗ℹ
Throughout the documentation, certain metavariable names are used in
syntax descriptions to standard for common syntactic categories, such as
identifiers, expressions, or binding patterns.
An
id or
op is a
shrubbery
identifier or operator, respectively. Some syntactic contexts require
specifically an identifier, some require specifically an operator, and
some allow either, as represented by
id_or_op.
Unless otherwise specified, a name like something_id is
an alias for id, and the something_ prefix
merely serves to suggest the intent of the identifier and allow a
reference to a specific identifier position within a grammar.
In syntax descriptions,
expr stands for any expression form.
Function calls, arithmetic,
block, and
match are
some examples of expression forms, but
rhombus provides
many more.
Besides all of the expression forms provided by
rhombus, new ones can be defined with macro
or expr.macro.
Unless otherwise specified, a name like fun_expr is an
alias for expr, similar to the rule for id.
In syntax descriptions,
repet stands for any
repetition form. Identifiers (especially ones bound as
repetitions), function calls, and arithmetic are some examples of
repetition forms, but
rhombus provides many more.
Besides all of the expression forms provided by
rhombus, new ones can be defined with
repet.macro.
In syntax descriptions,
entry_point stands for an
entry
point, which is syntactically an immediate function. The
fun
and
macro expression forms also work as entry-point forms.
In syntax descriptions,
immediate_callee stands for an
immediate callee, which is syntactically an immediate
function. The
fun expression form also
works as an immediate-callee form, as well as the
#%parens form when used with
_.
In syntax descriptions,
defn stands for any definition
form. The
def,
let, and
class forms are
examples of definition forms.
Besides all of the expression forms provided by
rhombus, new ones can be defined with
defn.macro.
In syntax descriptions,
body is always used with ellipses
afterward, meaning that definitions and expressions can be interleaved.
In some cases, the expanded form of the
body sequence must ends
with an expression to provide a result value.
Unless noted otherwise, a body sequence implicitly uses
#%body. The context for the implicit #%body
binding is associated with the : delimiter that forms the
enclosing block. Use the Block to match a block and
preserve its context for referencing #%body.
In syntax descriptions,
decl is a form that can appear
immediately in a module, and a
nestable_decl is a form like
export that can appear in a
namespace or in a
module.
Besides forms provided by
rhombus, new ones can be defined with
decl.macro and decl.nestable_macro.
In syntax descriptions,
bind refers to any binding form,
which might be simply an identifier, a binding form annotated with
:: or
:~, or a larger binding pattern.
Besides all of the binding forms provided by rhombus,
new ones can be defined with bind.macro.
Besides all of the annotation forms provided by
rhombus, new ones can be defined with
annot.macro.
Besides all of the reducer forms provided by
rhombus, new ones can be defined with
reducer.macro.
Refers to an identifier or operator that is potentially accessed
through a dotted sequence to access a namespace or import. The full name
might refer to an identifier or operator that is already bound, or it
might be used in a binding position to extend an existing namespace with
a binding for the identifier or operator. In either context, in an
id_name or
op_name, each
id before a dot must refer to a namespace or import.
In syntax descriptions,
keyword stands for any keyword in the
shrubbery sense. For example,
~weaker_than and
~op_stx are keywords.
In syntax descriptions,
pattern and
template each
stand for an arbitrary shrubbery form that is used for syntax matching
or syntax generation, respectively.
See the #%quotes binding form for information on
syntax matching, and see the #%quotes expression form for
information on syntax generation.
In syntax descriptions,
key_comp stands for any operator or
identifier that is defined as an equality and hashing configuration for a
map’s keys.
The map configurations exported by rhombus are
== (the default), ===,
is_now, and is_same_number_or_object.
New configurations can be defined with key_comp.def.