8.12

6.1 General Forms🔗ℹ

id

 

op

 

id_or_op

 = 

id

 | 

op

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 (especailly 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, 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.

body

 = 

expr

 | 

defn

In syntax descriptions, body is always used with ellipses afterward, meaning that definitions and expressons can be interleaved. In some cases, the expanded form of the body equence 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.

In syntax descriptions, annot stands for any annotation form.

Besides all of the annotation forms provided by rhombus, new ones can be defined with annot.macro.

In syntax descriptions, reducer stands for any reducer form.

Besides all of the reducer forms provided by rhombus, new ones can be defined with reducer.macro.

id_name

 = 

id

 | 

id_name . id

 

op_name

 = 

op

 | 

id_name . (op)

 

op_or_id_name

 = 

op_name

 | 

id_name

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 configration 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.