[mlir][LangRef] Add top-level production to the MLIR grammar
authorSiddharth Bhat <siddu.druid@gmail.com>
Fri, 21 Jan 2022 11:32:39 +0000 (17:02 +0530)
committerGroverkss <groverkss@gmail.com>
Fri, 21 Jan 2022 11:38:53 +0000 (17:08 +0530)
The LangRef currently lacks a top-level production, leaving the productions attribute-alias-def and type-alias-defunused. Clarify the situation by declaring what is to be parsed by an MLIR parser at the toplevel.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D117668

mlir/docs/LangRef.md

index 357778a..4b956c5 100644 (file)
@@ -179,6 +179,19 @@ string-literal  ::= `"` [^"\n\f\v\r]* `"`   TODO: define escaping rules
 Not listed here, but MLIR does support comments. They use standard BCPL syntax,
 starting with a `//` and going until the end of the line.
 
+
+### Top level Productions
+
+```
+// Top level production
+toplevel := (operation | attribute-alias-def | type-alias-def)*
+```
+
+The production `toplevel` is the top level production that is parsed by any parsing
+consuming the MLIR syntax. [Operations](#operations),
+[Attribute alises](#attribute-value-aliases), and [Type aliases](#type-aliases)
+can be declared on the toplevel.
+
 ### Identifiers and keywords
 
 Syntax: