1*10f8be19SRamkumar Ramachandra'use strict'; 2*10f8be19SRamkumar Ramachandra 3*10f8be19SRamkumar Ramachandramodule.exports = { 4*10f8be19SRamkumar Ramachandra math_dialect : $ => choice( 5*10f8be19SRamkumar Ramachandra // operation ::= `math.absf` $operand (`fastmath` `` 6*10f8be19SRamkumar Ramachandra // $fastmath^)? 7*10f8be19SRamkumar Ramachandra // attr-dict `:` type($result) 8*10f8be19SRamkumar Ramachandra // operation ::= `math.atan` $operand (`fastmath` `` 9*10f8be19SRamkumar Ramachandra // $fastmath^)? 10*10f8be19SRamkumar Ramachandra // attr-dict `:` type($result) 11*10f8be19SRamkumar Ramachandra // operation ::= `math.cbrt` $operand (`fastmath` `` 12*10f8be19SRamkumar Ramachandra // $fastmath^)? 13*10f8be19SRamkumar Ramachandra // attr-dict `:` type($result) 14*10f8be19SRamkumar Ramachandra // operation ::= `math.ceil` $operand (`fastmath` `` 15*10f8be19SRamkumar Ramachandra // $fastmath^)? 16*10f8be19SRamkumar Ramachandra // attr-dict `:` type($result) 17*10f8be19SRamkumar Ramachandra // operation ::= `math.cos` $operand (`fastmath` `` 18*10f8be19SRamkumar Ramachandra // $fastmath^)? 19*10f8be19SRamkumar Ramachandra // attr-dict `:` type($result) 20*10f8be19SRamkumar Ramachandra // operation ::= `math.erf` $operand (`fastmath` `` 21*10f8be19SRamkumar Ramachandra // $fastmath^)? 22*10f8be19SRamkumar Ramachandra // attr-dict `:` type($result) 23*10f8be19SRamkumar Ramachandra // operation ::= `math.exp` $operand (`fastmath` `` 24*10f8be19SRamkumar Ramachandra // $fastmath^)? 25*10f8be19SRamkumar Ramachandra // attr-dict `:` type($result) 26*10f8be19SRamkumar Ramachandra // operation ::= `math.exp2` $operand (`fastmath` `` 27*10f8be19SRamkumar Ramachandra // $fastmath^)? 28*10f8be19SRamkumar Ramachandra // attr-dict `:` type($result) 29*10f8be19SRamkumar Ramachandra // operation ::= `math.expm1` $operand (`fastmath` `` 30*10f8be19SRamkumar Ramachandra // $fastmath^)? 31*10f8be19SRamkumar Ramachandra // attr-dict `:` type($result) 32*10f8be19SRamkumar Ramachandra // operation ::= `math.floor` $operand (`fastmath` `` 33*10f8be19SRamkumar Ramachandra // $fastmath^)? 34*10f8be19SRamkumar Ramachandra // attr-dict `:` type($result) 35*10f8be19SRamkumar Ramachandra // operation ::= `math.log` $operand (`fastmath` `` 36*10f8be19SRamkumar Ramachandra // $fastmath^)? 37*10f8be19SRamkumar Ramachandra // attr-dict `:` type($result) 38*10f8be19SRamkumar Ramachandra // operation ::= `math.log10` $operand (`fastmath` `` 39*10f8be19SRamkumar Ramachandra // $fastmath^)? 40*10f8be19SRamkumar Ramachandra // attr-dict `:` type($result) 41*10f8be19SRamkumar Ramachandra // operation ::= `math.log1p` $operand (`fastmath` `` 42*10f8be19SRamkumar Ramachandra // $fastmath^)? 43*10f8be19SRamkumar Ramachandra // attr-dict `:` type($result) 44*10f8be19SRamkumar Ramachandra // operation ::= `math.log2` $operand (`fastmath` `` 45*10f8be19SRamkumar Ramachandra // $fastmath^)? 46*10f8be19SRamkumar Ramachandra // attr-dict `:` type($result) 47*10f8be19SRamkumar Ramachandra // operation ::= `math.round` $operand (`fastmath` `` 48*10f8be19SRamkumar Ramachandra // $fastmath^)? 49*10f8be19SRamkumar Ramachandra // attr-dict `:` type($result) 50*10f8be19SRamkumar Ramachandra // operation ::= `math.roundeven` $operand (`fastmath` `` 51*10f8be19SRamkumar Ramachandra // $fastmath^)? 52*10f8be19SRamkumar Ramachandra // attr-dict `:` type($result) 53*10f8be19SRamkumar Ramachandra // operation ::= `math.rsqrt` $operand (`fastmath` `` 54*10f8be19SRamkumar Ramachandra // $fastmath^)? 55*10f8be19SRamkumar Ramachandra // attr-dict `:` type($result) 56*10f8be19SRamkumar Ramachandra // operation ::= `math.sin` $operand (`fastmath` `` 57*10f8be19SRamkumar Ramachandra // $fastmath^)? 58*10f8be19SRamkumar Ramachandra // attr-dict `:` type($result) 59*10f8be19SRamkumar Ramachandra // operation ::= `math.sqrt` $operand (`fastmath` `` 60*10f8be19SRamkumar Ramachandra // $fastmath^)? 61*10f8be19SRamkumar Ramachandra // attr-dict `:` type($result) 62*10f8be19SRamkumar Ramachandra // operation ::= `math.tan` $operand (`fastmath` `` 63*10f8be19SRamkumar Ramachandra // $fastmath^)? 64*10f8be19SRamkumar Ramachandra // attr-dict `:` type($result) 65*10f8be19SRamkumar Ramachandra // operation ::= `math.tanh` $operand (`fastmath` `` 66*10f8be19SRamkumar Ramachandra // $fastmath^)? 67*10f8be19SRamkumar Ramachandra // attr-dict `:` type($result) 68*10f8be19SRamkumar Ramachandra // operation ::= `math.trunc` $operand (`fastmath` `` 69*10f8be19SRamkumar Ramachandra // $fastmath^)? 70*10f8be19SRamkumar Ramachandra // attr-dict `:` type($result) 71*10f8be19SRamkumar Ramachandra seq(choice('math.absf', 'math.atan', 'math.cbrt', 72*10f8be19SRamkumar Ramachandra 'math.ceil', 'math.cos', 'math.erf', 'math.exp', 73*10f8be19SRamkumar Ramachandra 'math.exp2', 'math.expm1', 'math.floor', 74*10f8be19SRamkumar Ramachandra 'math.log', 'math.log10', 'math.log1p', 75*10f8be19SRamkumar Ramachandra 'math.log2', 'math.round', 'math.roundeven', 76*10f8be19SRamkumar Ramachandra 'math.rsqrt', 'math.sin', 'math.sqrt', 'math.tan', 77*10f8be19SRamkumar Ramachandra 'math.tanh', 'math.trunc'), 78*10f8be19SRamkumar Ramachandra field('operand', $.value_use), 79*10f8be19SRamkumar Ramachandra field('fastmath', optional($.fastmath_attr)), 80*10f8be19SRamkumar Ramachandra field('attributes', optional($.attribute)), 81*10f8be19SRamkumar Ramachandra field('return', $._type_annotation)), 82*10f8be19SRamkumar Ramachandra 83*10f8be19SRamkumar Ramachandra // operation ::= `math.absi` $operand attr-dict `:` 84*10f8be19SRamkumar Ramachandra // type($result) operation ::= `math.ctlz` $operand attr-dict 85*10f8be19SRamkumar Ramachandra // `:` type($result) operation ::= `math.cttz` $operand 86*10f8be19SRamkumar Ramachandra // attr-dict `:` type($result) operation ::= `math.ctpop` 87*10f8be19SRamkumar Ramachandra // $operand attr-dict `:` type($result) 88*10f8be19SRamkumar Ramachandra seq(choice('math.absi', 'math.ctlz', 'math.cttz', 89*10f8be19SRamkumar Ramachandra 'math.ctpop'), 90*10f8be19SRamkumar Ramachandra field('operand', $.value_use), 91*10f8be19SRamkumar Ramachandra field('attributes', optional($.attribute)), 92*10f8be19SRamkumar Ramachandra field('return', $._type_annotation)), 93*10f8be19SRamkumar Ramachandra 94*10f8be19SRamkumar Ramachandra // operation ::= `math.atan2` $lhs `,` $rhs (`fastmath` `` 95*10f8be19SRamkumar Ramachandra // $fastmath^)? 96*10f8be19SRamkumar Ramachandra // attr-dict `:` type($result) 97*10f8be19SRamkumar Ramachandra // operation ::= `math.copysign` $lhs `,` $rhs (`fastmath` `` 98*10f8be19SRamkumar Ramachandra // $fastmath^)? 99*10f8be19SRamkumar Ramachandra // attr-dict `:` type($result) 100*10f8be19SRamkumar Ramachandra // operation ::= `math.fpowi` $lhs `,` $rhs (`fastmath` `` 101*10f8be19SRamkumar Ramachandra // $fastmath^)? 102*10f8be19SRamkumar Ramachandra // attr-dict `:` type($lhs) `,` type($rhs) 103*10f8be19SRamkumar Ramachandra // operation ::= `math.powf` $lhs `,` $rhs (`fastmath` `` 104*10f8be19SRamkumar Ramachandra // $fastmath^)? 105*10f8be19SRamkumar Ramachandra // attr-dict `:` type($result) 106*10f8be19SRamkumar Ramachandra seq(choice('math.atan2', 'math.copysign', 'math.fpowi', 107*10f8be19SRamkumar Ramachandra 'math.powf'), 108*10f8be19SRamkumar Ramachandra field('lhs', $.value_use), ',', 109*10f8be19SRamkumar Ramachandra field('rhs', $.value_use), 110*10f8be19SRamkumar Ramachandra field('fastmath', optional($.fastmath_attr)), 111*10f8be19SRamkumar Ramachandra field('attributes', optional($.attribute)), 112*10f8be19SRamkumar Ramachandra field('return', $._type_annotation)), 113*10f8be19SRamkumar Ramachandra 114*10f8be19SRamkumar Ramachandra // operation ::= `math.ipowi` $lhs `,` $rhs attr-dict `:` 115*10f8be19SRamkumar Ramachandra // type($result) 116*10f8be19SRamkumar Ramachandra seq('math.ipowi', field('lhs', $.value_use), ',', 117*10f8be19SRamkumar Ramachandra field('rhs', $.value_use), 118*10f8be19SRamkumar Ramachandra field('attributes', optional($.attribute)), 119*10f8be19SRamkumar Ramachandra field('return', $._type_annotation)), 120*10f8be19SRamkumar Ramachandra 121*10f8be19SRamkumar Ramachandra // operation ::= `math.fma` $a `,` $b `,` $c (`fastmath` `` 122*10f8be19SRamkumar Ramachandra // $fastmath^)? 123*10f8be19SRamkumar Ramachandra // attr-dict `:` type($result) 124*10f8be19SRamkumar Ramachandra seq('math.fma', field('a', $.value_use), ',', 125*10f8be19SRamkumar Ramachandra field('b', $.value_use), ',', field('c', $.value_use), 126*10f8be19SRamkumar Ramachandra field('fastmath', optional($.fastmath_attr)), 127*10f8be19SRamkumar Ramachandra field('attributes', optional($.attribute)), 128*10f8be19SRamkumar Ramachandra field('return', $._type_annotation))) 129*10f8be19SRamkumar Ramachandra} 130