22.6 EBC Instruction Syntax
Most EBC instructions have one or more variations that modify the size of the instruction and/or the behavior of the
instruction itself. These variations will typically modify an instruction in one or more of the following ways:
• The size of the data being operated upon
• The addressing mode for the operands
• The size of index or immediate data
• To represent these variations syntactically in this specification the following conventions are used:
• Natural indexes are indicated with the “Index” keyword, and may take the form of “Index16,” “Index32,” or “In-
dex64” to indicate the size of the index value supported. Sometimes the form Index16|32|64 is used here, which
is simply a shorthand notation for Index16|Index32|Index64. A natural index is encoded per Index Encoding is
resolved at runtime.
• Immediate values are indicated with the “Immed” keyword, and may take the form of “Immed16,” “Immed32,”
or “Immed64” to indicate the size of the immediate value supported. The shorthand notation Immed16|32|64 is
sometimes used when different size immediate values are supported.
• Terms in brackets [ ] are required.
• Terms in braces { } are optional.
• Alternate terms are separated by a vertical bar |.
• The form R1 and R2 represent Operand 1 register and Operand 2 register respectfully, and can typically be any
VM general-purpose register R0-R7.
• Within descriptions of the instructions, brackets [ ] enclosing a register and/or index indicate that the contents of
the memory pointed to by the enclosed contents are used.
При написании своей спецификации имело бы смысл все эти соглашения пронумеровать каждое,
чтобы иметь возможность на них ссылаться (§ 2.6.1). И сослаться в каждом описании каждой инструкции,
для того, чтобы описании инструкции стало более понятным.
Обычно, кстати, наоборот - опциональное в квадратных скобках, а не обязательное.
RFC 4234 / Augmented BNF for Syntax Specifications
POSIX shell / man-страницы и IEEE Std 1003.1 (POSIX)
BNF/EBNF в реализации ISO/IEC 14977 (Extended Backus–Naur Form — EBNF)
синтаксис ABNF из RFC 5234 и демонстрируют опцию в [ ] при описании команд/параметров
Microsoft MSDN / Windows API документация: в описаниях сигнатур API и команд опциональные параметры часто показывают в квадратных скобках.
SQL стандарты и документация (напр., спецификации диалектов и руководства): опциональные части синтаксиса в BNF/EBNF примечаниях обычно показаны в [ ]
GNU autotools/autoconf manual и многие Unix‑руководства: использование [ ] для опциональных аргументов команд/флагов.
ANSI‑C yacc / Berkeley yacc использует синтаксис, основанный на BNF
Отредактировано Лис (Сегодня 04:09:47)