Skip to content

Commit fc9477e

Browse files
author
mikeblome
committed
final text for bnf intro and added image
1 parent dcb02f3 commit fc9477e

2 files changed

Lines changed: 11 additions & 16 deletions

File tree

docs/assembler/masm/masm-bnf-grammar.md

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
11
---
22
title: "Microsoft Macro Assembler BNF Grammar"
3-
description: "Formal BNF description of MASM for x64."
3+
description: "BNF description of MASM for x64."
44
ms.date: "12/17/2019"
55
helpviewer_keywords: ["MASM (Microsoft Macro Assembler), BNF reference"]
66
---
77

88
# Microsoft Macro Assembler BNF Grammar
99

10-
To illustrate the use of the BNF, Figure B.1 diagrams the definition of the TYPEDEF directive, starting
11-
with the nonterminal typedefDir.
10+
This page contains a BNF description of the MASM grammar. It is provided for illustrative purposes and is not guaranteed to be complete. Please consult the reference topics for full information on keywords, parameters, operations and so on.
1211

13-
The entries under each horizontal brace in Figure B.1 are terminals (such as NEAR16, NEAR32,
14-
FAR16, and FAR32) or nonterminals (such as qualifier, qualifiedType, distance, and protoSpec) that
15-
can be further defined. Each italicized nonterminal in the typedefDir definition is also an entry in the
16-
BNF. Three vertical dots indicate a branching definition for a nonterminal that, for the sake of
17-
simplicity, this figure does not illustrate.
12+
To illustrate the use of the BNF, the following diagram shows the definition of the TYPEDEF directive, starting with the nonterminal *typedefDir*.
1813

19-
The BNF grammar allows recursive definitions. For example, the grammar uses qualifiedType as a
20-
possible definition for qualifiedType, which is also a component of the definition for qualifier.
14+
![MASM BNF Example](media/bnf.png)
15+
16+
The entries under each horizontal brace are terminals (such as **NEAR16**, **NEAR32**, **FAR16**, and **FAR32**) or nonterminals (such as *qualifier*, *qualifiedType*, *distance*, and *protoSpec*) that can be further defined. Each italicized nonterminal in the *typedefDir* definition is also an entry in the BNF. Three vertical dots indicate a branching definition for a nonterminal that, for the sake of simplicity, this figure does not illustrate.
17+
18+
The BNF grammar allows recursive definitions. For example, the grammar uses qualifiedType as a possible definition for qualifiedType, which is also a component of the definition for qualifier. The "|" symbol specifies alternate expressions, for example *endOfLine* | *comment*. Double braces specify an optional parameter, for example ⟦ *macroParmList* ⟧.
2119

2220
## MASM Nonterminals
2321

@@ -572,7 +570,7 @@ possible definition for qualifiedType, which is also a component of the definiti
572570

573571
*macroArg*\
574572
% *constExpr*\
575-
    | % *textMacroId*\
573+
    | %*textMacroId*\
576574
    | %*macroFuncId* ( *macroArgList* )\
577575
    | *string*\
578576
    | *arbitraryText*\
@@ -767,11 +765,8 @@ possible definition for qualifiedType, which is also a component of the definiti
767765
    *usesRegs* ⟧ ⟦ *procParmList*
768766

769767
*processor*\
770-
.8086\
771-
    | .186\
772-
    | .286 | .286C | .286P\
773-
    | .386 | .386C | .386P\
774-
    | .486 | .486P
768+
    | .386 | .386p | .486 | .486P\
769+
    | .586 | .586P | .686 | .686P | .387
775770

776771
*processorDir*\
777772
    *processor* ;;\

docs/assembler/masm/media/bnf.png

9.79 KB
Loading

0 commit comments

Comments
 (0)