14. Dependency Expression Grammar¶
14.1. Dependency Expression Grammar¶
This topic contains an example BNF grammar for a PEIM dependency expression compiler that converts a dependency expression source file into a dependency section of a PEIM stored in a firmware volume.
14.1.1. Example Dependency Expression BNF Grammar¶
<depex> ::= <bool>
<bool> ::= <bool> AND <term>
| <bool> OR <term>
| <term>
<term> ::= NOT <factor>
| <factor>
<factor> ::= <bool>
| TRUE
| FALSE
| GUID
| END
<guid> ::= ‘{‘ <hex32> ‘,’ <hex16> ‘,’ <hex16> ‘,’
<hex8> ‘,’ <hex8> ‘,’ <hex8> ‘,’ <hex8> ‘,’
<hex8> ‘,’ <hex8> ‘,’ <hex8> ‘,’ <hex8> ’}’
<hex32> ::= <hexprefix> <hexvalue>
<hex16> ::= <hexprefix> <hexvalue>
<hex8> ::= <hexprefix> <hexvalue>
<hexprefix> ::= ‘0’ ‘x’
| ‘0’ ‘X’
<hexvalue> ::= <hexdigit> <hexvalue>
| <hexdigit>
<hexdigit> ::= [0-9]
| [a-f]
| [A-F]
14.1.2. Sample Dependency Expressions¶
The following contains three examples of source statements using the BNF grammar from above along with the opcodes, operands, and binary encoding that a dependency expression compiler would generate from these source statements.
//
// Source
//
EFI_PEI_CPU_IO_PPI_GUID AND EFI_PEI_READ_ONLY_VARIABLE_ACCESS_PPI_GUID
END
//
// Opcodes, Operands, and Binary Encoding
//
ADDR BINARY MNEMONIC
==== ======================= =======================
0x00 : 02 PUSH
0x01 : 26 25 73 b0 c8 38 40 4b EFI_PEI_CPU_IO_PPI_GUID
88 77 61 c7 b0 6a ac 45
0x11 : 02 PUSH
0x12 : b1 cc ba 26 42 6f d4 11
EFI_PEI_READ_ONLY_VARIABLE_ACCESS_PPI_GUID
bc e7 00 80 c7 3c 88 81
0x22 : 03 AND
0x23 : 08 END