Files
clang-p2996/mlir/utils/tree-sitter-mlir/dialect/builtin.js
Ramkumar Ramachandra 10f8be19e7 tree-sitter-mlir: add a more complete grammar
Contribute a grammar, along with associated tests, from the upstream
project maintained at https://github.com/artagnon/tree-sitter-mlir. The
new grammar includes several fixes, and successfully parses 60-80% of
MLIR tests in the Arith, Math, ControlFlow, SCF, Tensor, Affine, and
Linalg dialects.

Differential Revision: https://reviews.llvm.org/D144408
2023-06-05 19:11:06 +01:00

21 lines
1023 B
JavaScript

'use strict';
module.exports = {
builtin_dialect : $ => prec.right(choice(
// operation ::= `builtin.module` ($sym_name^)?
// attr-dict-with-keyword $bodyRegion
seq(choice('builtin.module', 'module'),
field('name', optional($.bare_id)),
field('attributes', optional($.attribute)),
field('body', $.region)),
// operation ::= `builtin.unrealized_conversion_cast`
// ($inputs^ `:` type($inputs))?
// `to` type($outputs) attr-dict
seq(choice('builtin.unrealized_conversion_cast',
'unrealized_conversion_cast'),
field('inputs', optional($._value_use_type_list)),
token('to'), field('outputs', $._type_list_no_parens),
field('attributes', optional($.attribute)))))
}