Update comments in ast.toy

PiperOrigin-RevId: 275084969
This commit is contained in:
Jacques Pienaar 2019-10-16 12:07:56 -07:00 committed by A. Unique TensorFlower
parent a3726a13f7
commit e88dbc8c95
3 changed files with 87 additions and 84 deletions

View File

@ -1,7 +1,6 @@
# RUN: toyc-ch1 %s -emit=ast 2>&1 | FileCheck %s
# User defined generic function that operates solely on
# User defined generic function that operates on unknown shaped arguments.
def multiply_transpose(a, b) {
return a * transpose(b);
}
@ -11,8 +10,10 @@ def main() {
# The shape is inferred from the supplied literal.
var a = [[1, 2, 3], [4, 5, 6]];
# b is identical to a, the literal array is implicitly reshaped: defining new
# variables is the way to reshape arrays (element count must match).
# variables is the way to reshape arrays (element count in literal must match
# the size of specified shape).
var b<2, 3> = [1, 2, 3, 4, 5, 6];
# This call will specialize `multiply_transpose` with <2, 3> for both
# arguments and deduce a return type of <2, 2> in initialization of `c`.
var c = multiply_transpose(a, b);
@ -30,44 +31,44 @@ def main() {
# CHECK: Module:
# CHECK-NEXT: Function
# CHECK-NEXT: Proto 'multiply_transpose' @{{.*}}ast.toy:5:1'
# CHECK-NEXT: Proto 'multiply_transpose' @{{.*}}ast.toy:4:1'
# CHECK-NEXT: Params: [a, b]
# CHECK-NEXT: Block {
# CHECK-NEXT: Retur
# CHECK-NEXT: BinOp: * @{{.*}}ast.toy:6:14
# CHECK-NEXT: var: a @{{.*}}ast.toy:6:10
# CHECK-NEXT: Call 'transpose' [ @{{.*}}ast.toy:6:14
# CHECK-NEXT: var: b @{{.*}}ast.toy:6:24
# CHECK-NEXT: BinOp: * @{{.*}}ast.toy:5:14
# CHECK-NEXT: var: a @{{.*}}ast.toy:5:10
# CHECK-NEXT: Call 'transpose' [ @{{.*}}ast.toy:5:14
# CHECK-NEXT: var: b @{{.*}}ast.toy:5:24
# CHECK-NEXT: ]
# CHECK-NEXT: } // Block
# CHECK-NEXT: Function
# CHECK-NEXT: Proto 'main' @{{.*}}ast.toy:9:1'
# CHECK-NEXT: Proto 'main' @{{.*}}ast.toy:8:1'
# CHECK-NEXT: Params: []
# CHECK-NEXT: Block {
# CHECK-NEXT: VarDecl a<> @{{.*}}ast.toy:12:3
# CHECK-NEXT: Literal: <2, 3>[ <3>[ 1.000000e+00, 2.000000e+00, 3.000000e+00], <3>[ 4.000000e+00, 5.000000e+00, 6.000000e+00]] @{{.*}}ast.toy:12:11
# CHECK-NEXT: VarDecl a<> @{{.*}}ast.toy:11:3
# CHECK-NEXT: Literal: <2, 3>[ <3>[ 1.000000e+00, 2.000000e+00, 3.000000e+00], <3>[ 4.000000e+00, 5.000000e+00, 6.000000e+00]] @{{.*}}ast.toy:11:11
# CHECK-NEXT: VarDecl b<2, 3> @{{.*}}ast.toy:15:3
# CHECK-NEXT: Literal: <6>[ 1.000000e+00, 2.000000e+00, 3.000000e+00, 4.000000e+00, 5.000000e+00, 6.000000e+00] @{{.*}}ast.toy:15:17
# CHECK-NEXT: VarDecl c<> @{{.*}}ast.toy:18:3
# CHECK-NEXT: Call 'multiply_transpose' [ @{{.*}}ast.toy:18:11
# CHECK-NEXT: var: a @{{.*}}ast.toy:18:30
# CHECK-NEXT: var: b @{{.*}}ast.toy:18:33
# CHECK-NEXT: VarDecl c<> @{{.*}}ast.toy:19:3
# CHECK-NEXT: Call 'multiply_transpose' [ @{{.*}}ast.toy:19:11
# CHECK-NEXT: var: a @{{.*}}ast.toy:19:30
# CHECK-NEXT: var: b @{{.*}}ast.toy:19:33
# CHECK-NEXT: ]
# CHECK-NEXT: VarDecl d<> @{{.*}}ast.toy:21:3
# CHECK-NEXT: Call 'multiply_transpose' [ @{{.*}}ast.toy:21:11
# CHECK-NEXT: var: b @{{.*}}ast.toy:21:30
# CHECK-NEXT: var: a @{{.*}}ast.toy:21:33
# CHECK-NEXT: VarDecl d<> @{{.*}}ast.toy:22:3
# CHECK-NEXT: Call 'multiply_transpose' [ @{{.*}}ast.toy:22:11
# CHECK-NEXT: var: b @{{.*}}ast.toy:22:30
# CHECK-NEXT: var: a @{{.*}}ast.toy:22:33
# CHECK-NEXT: ]
# CHECK-NEXT: VarDecl e<> @{{.*}}ast.toy:24:3
# CHECK-NEXT: Call 'multiply_transpose' [ @{{.*}}ast.toy:24:11
# CHECK-NEXT: var: b @{{.*}}ast.toy:24:30
# CHECK-NEXT: var: c @{{.*}}ast.toy:24:33
# CHECK-NEXT: VarDecl e<> @{{.*}}ast.toy:25:3
# CHECK-NEXT: Call 'multiply_transpose' [ @{{.*}}ast.toy:25:11
# CHECK-NEXT: var: b @{{.*}}ast.toy:25:30
# CHECK-NEXT: var: c @{{.*}}ast.toy:25:33
# CHECK-NEXT: ]
# CHECK-NEXT: VarDecl e<> @{{.*}}ast.toy:27:3
# CHECK-NEXT: Call 'multiply_transpose' [ @{{.*}}ast.toy:27:11
# CHECK-NEXT: Call 'transpose' [ @{{.*}}ast.toy:27:30
# CHECK-NEXT: var: a @{{.*}}ast.toy:27:40
# CHECK-NEXT: VarDecl e<> @{{.*}}ast.toy:28:3
# CHECK-NEXT: Call 'multiply_transpose' [ @{{.*}}ast.toy:28:11
# CHECK-NEXT: Call 'transpose' [ @{{.*}}ast.toy:28:30
# CHECK-NEXT: var: a @{{.*}}ast.toy:28:40
# CHECK-NEXT: ]
# CHECK-NEXT: var: c @{{.*}}ast.toy:27:44
# CHECK-NEXT: var: c @{{.*}}ast.toy:28:44
# CHECK-NEXT: ]

View File

@ -1,7 +1,6 @@
# RUN: toyc-ch2 %s -emit=ast 2>&1 | FileCheck %s
# User defined generic function that operates solely on
# User defined generic function that operates on unknown shaped arguments.
def multiply_transpose(a, b) {
return a * transpose(b);
}
@ -11,8 +10,10 @@ def main() {
# The shape is inferred from the supplied literal.
var a = [[1, 2, 3], [4, 5, 6]];
# b is identical to a, the literal array is implicitly reshaped: defining new
# variables is the way to reshape arrays (element count must match).
# variables is the way to reshape arrays (element count in literal must match
# the size of specified shape).
var b<2, 3> = [1, 2, 3, 4, 5, 6];
# This call will specialize `multiply_transpose` with <2, 3> for both
# arguments and deduce a return type of <2, 2> in initialization of `c`.
var c = multiply_transpose(a, b);
@ -30,44 +31,44 @@ def main() {
# CHECK: Module:
# CHECK-NEXT: Function
# CHECK-NEXT: Proto 'multiply_transpose' @{{.*}}ast.toy:5:1'
# CHECK-NEXT: Proto 'multiply_transpose' @{{.*}}ast.toy:4:1'
# CHECK-NEXT: Params: [a, b]
# CHECK-NEXT: Block {
# CHECK-NEXT: Retur
# CHECK-NEXT: BinOp: * @{{.*}}ast.toy:6:14
# CHECK-NEXT: var: a @{{.*}}ast.toy:6:10
# CHECK-NEXT: Call 'transpose' [ @{{.*}}ast.toy:6:14
# CHECK-NEXT: var: b @{{.*}}ast.toy:6:24
# CHECK-NEXT: BinOp: * @{{.*}}ast.toy:5:14
# CHECK-NEXT: var: a @{{.*}}ast.toy:5:10
# CHECK-NEXT: Call 'transpose' [ @{{.*}}ast.toy:5:14
# CHECK-NEXT: var: b @{{.*}}ast.toy:5:24
# CHECK-NEXT: ]
# CHECK-NEXT: } // Block
# CHECK-NEXT: Function
# CHECK-NEXT: Proto 'main' @{{.*}}ast.toy:9:1'
# CHECK-NEXT: Proto 'main' @{{.*}}ast.toy:8:1'
# CHECK-NEXT: Params: []
# CHECK-NEXT: Block {
# CHECK-NEXT: VarDecl a<> @{{.*}}ast.toy:12:3
# CHECK-NEXT: Literal: <2, 3>[ <3>[ 1.000000e+00, 2.000000e+00, 3.000000e+00], <3>[ 4.000000e+00, 5.000000e+00, 6.000000e+00]] @{{.*}}ast.toy:12:11
# CHECK-NEXT: VarDecl a<> @{{.*}}ast.toy:11:3
# CHECK-NEXT: Literal: <2, 3>[ <3>[ 1.000000e+00, 2.000000e+00, 3.000000e+00], <3>[ 4.000000e+00, 5.000000e+00, 6.000000e+00]] @{{.*}}ast.toy:11:11
# CHECK-NEXT: VarDecl b<2, 3> @{{.*}}ast.toy:15:3
# CHECK-NEXT: Literal: <6>[ 1.000000e+00, 2.000000e+00, 3.000000e+00, 4.000000e+00, 5.000000e+00, 6.000000e+00] @{{.*}}ast.toy:15:17
# CHECK-NEXT: VarDecl c<> @{{.*}}ast.toy:18:3
# CHECK-NEXT: Call 'multiply_transpose' [ @{{.*}}ast.toy:18:11
# CHECK-NEXT: var: a @{{.*}}ast.toy:18:30
# CHECK-NEXT: var: b @{{.*}}ast.toy:18:33
# CHECK-NEXT: VarDecl c<> @{{.*}}ast.toy:19:3
# CHECK-NEXT: Call 'multiply_transpose' [ @{{.*}}ast.toy:19:11
# CHECK-NEXT: var: a @{{.*}}ast.toy:19:30
# CHECK-NEXT: var: b @{{.*}}ast.toy:19:33
# CHECK-NEXT: ]
# CHECK-NEXT: VarDecl d<> @{{.*}}ast.toy:21:3
# CHECK-NEXT: Call 'multiply_transpose' [ @{{.*}}ast.toy:21:11
# CHECK-NEXT: var: b @{{.*}}ast.toy:21:30
# CHECK-NEXT: var: a @{{.*}}ast.toy:21:33
# CHECK-NEXT: VarDecl d<> @{{.*}}ast.toy:22:3
# CHECK-NEXT: Call 'multiply_transpose' [ @{{.*}}ast.toy:22:11
# CHECK-NEXT: var: b @{{.*}}ast.toy:22:30
# CHECK-NEXT: var: a @{{.*}}ast.toy:22:33
# CHECK-NEXT: ]
# CHECK-NEXT: VarDecl e<> @{{.*}}ast.toy:24:3
# CHECK-NEXT: Call 'multiply_transpose' [ @{{.*}}ast.toy:24:11
# CHECK-NEXT: var: b @{{.*}}ast.toy:24:30
# CHECK-NEXT: var: c @{{.*}}ast.toy:24:33
# CHECK-NEXT: VarDecl e<> @{{.*}}ast.toy:25:3
# CHECK-NEXT: Call 'multiply_transpose' [ @{{.*}}ast.toy:25:11
# CHECK-NEXT: var: b @{{.*}}ast.toy:25:30
# CHECK-NEXT: var: c @{{.*}}ast.toy:25:33
# CHECK-NEXT: ]
# CHECK-NEXT: VarDecl e<> @{{.*}}ast.toy:27:3
# CHECK-NEXT: Call 'multiply_transpose' [ @{{.*}}ast.toy:27:11
# CHECK-NEXT: Call 'transpose' [ @{{.*}}ast.toy:27:30
# CHECK-NEXT: var: a @{{.*}}ast.toy:27:40
# CHECK-NEXT: VarDecl e<> @{{.*}}ast.toy:28:3
# CHECK-NEXT: Call 'multiply_transpose' [ @{{.*}}ast.toy:28:11
# CHECK-NEXT: Call 'transpose' [ @{{.*}}ast.toy:28:30
# CHECK-NEXT: var: a @{{.*}}ast.toy:28:40
# CHECK-NEXT: ]
# CHECK-NEXT: var: c @{{.*}}ast.toy:27:44
# CHECK-NEXT: var: c @{{.*}}ast.toy:28:44
# CHECK-NEXT: ]

View File

@ -1,7 +1,6 @@
# RUN: toyc-ch3 %s -emit=ast 2>&1 | FileCheck %s
# User defined generic function that operates solely on
# User defined generic function that operates on unknown shaped arguments.
def multiply_transpose(a, b) {
return a * transpose(b);
}
@ -11,8 +10,10 @@ def main() {
# The shape is inferred from the supplied literal.
var a = [[1, 2, 3], [4, 5, 6]];
# b is identical to a, the literal array is implicitly reshaped: defining new
# variables is the way to reshape arrays (element count must match).
# variables is the way to reshape arrays (element count in literal must match
# the size of specified shape).
var b<2, 3> = [1, 2, 3, 4, 5, 6];
# This call will specialize `multiply_transpose` with <2, 3> for both
# arguments and deduce a return type of <2, 2> in initialization of `c`.
var c = multiply_transpose(a, b);
@ -30,44 +31,44 @@ def main() {
# CHECK: Module:
# CHECK-NEXT: Function
# CHECK-NEXT: Proto 'multiply_transpose' @{{.*}}ast.toy:5:1'
# CHECK-NEXT: Proto 'multiply_transpose' @{{.*}}ast.toy:4:1'
# CHECK-NEXT: Params: [a, b]
# CHECK-NEXT: Block {
# CHECK-NEXT: Retur
# CHECK-NEXT: BinOp: * @{{.*}}ast.toy:6:14
# CHECK-NEXT: var: a @{{.*}}ast.toy:6:10
# CHECK-NEXT: Call 'transpose' [ @{{.*}}ast.toy:6:14
# CHECK-NEXT: var: b @{{.*}}ast.toy:6:24
# CHECK-NEXT: BinOp: * @{{.*}}ast.toy:5:14
# CHECK-NEXT: var: a @{{.*}}ast.toy:5:10
# CHECK-NEXT: Call 'transpose' [ @{{.*}}ast.toy:5:14
# CHECK-NEXT: var: b @{{.*}}ast.toy:5:24
# CHECK-NEXT: ]
# CHECK-NEXT: } // Block
# CHECK-NEXT: Function
# CHECK-NEXT: Proto 'main' @{{.*}}ast.toy:9:1'
# CHECK-NEXT: Proto 'main' @{{.*}}ast.toy:8:1'
# CHECK-NEXT: Params: []
# CHECK-NEXT: Block {
# CHECK-NEXT: VarDecl a<> @{{.*}}ast.toy:12:3
# CHECK-NEXT: Literal: <2, 3>[ <3>[ 1.000000e+00, 2.000000e+00, 3.000000e+00], <3>[ 4.000000e+00, 5.000000e+00, 6.000000e+00]] @{{.*}}ast.toy:12:11
# CHECK-NEXT: VarDecl a<> @{{.*}}ast.toy:11:3
# CHECK-NEXT: Literal: <2, 3>[ <3>[ 1.000000e+00, 2.000000e+00, 3.000000e+00], <3>[ 4.000000e+00, 5.000000e+00, 6.000000e+00]] @{{.*}}ast.toy:11:11
# CHECK-NEXT: VarDecl b<2, 3> @{{.*}}ast.toy:15:3
# CHECK-NEXT: Literal: <6>[ 1.000000e+00, 2.000000e+00, 3.000000e+00, 4.000000e+00, 5.000000e+00, 6.000000e+00] @{{.*}}ast.toy:15:17
# CHECK-NEXT: VarDecl c<> @{{.*}}ast.toy:18:3
# CHECK-NEXT: Call 'multiply_transpose' [ @{{.*}}ast.toy:18:11
# CHECK-NEXT: var: a @{{.*}}ast.toy:18:30
# CHECK-NEXT: var: b @{{.*}}ast.toy:18:33
# CHECK-NEXT: VarDecl c<> @{{.*}}ast.toy:19:3
# CHECK-NEXT: Call 'multiply_transpose' [ @{{.*}}ast.toy:19:11
# CHECK-NEXT: var: a @{{.*}}ast.toy:19:30
# CHECK-NEXT: var: b @{{.*}}ast.toy:19:33
# CHECK-NEXT: ]
# CHECK-NEXT: VarDecl d<> @{{.*}}ast.toy:21:3
# CHECK-NEXT: Call 'multiply_transpose' [ @{{.*}}ast.toy:21:11
# CHECK-NEXT: var: b @{{.*}}ast.toy:21:30
# CHECK-NEXT: var: a @{{.*}}ast.toy:21:33
# CHECK-NEXT: VarDecl d<> @{{.*}}ast.toy:22:3
# CHECK-NEXT: Call 'multiply_transpose' [ @{{.*}}ast.toy:22:11
# CHECK-NEXT: var: b @{{.*}}ast.toy:22:30
# CHECK-NEXT: var: a @{{.*}}ast.toy:22:33
# CHECK-NEXT: ]
# CHECK-NEXT: VarDecl e<> @{{.*}}ast.toy:24:3
# CHECK-NEXT: Call 'multiply_transpose' [ @{{.*}}ast.toy:24:11
# CHECK-NEXT: var: b @{{.*}}ast.toy:24:30
# CHECK-NEXT: var: c @{{.*}}ast.toy:24:33
# CHECK-NEXT: VarDecl e<> @{{.*}}ast.toy:25:3
# CHECK-NEXT: Call 'multiply_transpose' [ @{{.*}}ast.toy:25:11
# CHECK-NEXT: var: b @{{.*}}ast.toy:25:30
# CHECK-NEXT: var: c @{{.*}}ast.toy:25:33
# CHECK-NEXT: ]
# CHECK-NEXT: VarDecl e<> @{{.*}}ast.toy:27:3
# CHECK-NEXT: Call 'multiply_transpose' [ @{{.*}}ast.toy:27:11
# CHECK-NEXT: Call 'transpose' [ @{{.*}}ast.toy:27:30
# CHECK-NEXT: var: a @{{.*}}ast.toy:27:40
# CHECK-NEXT: VarDecl e<> @{{.*}}ast.toy:28:3
# CHECK-NEXT: Call 'multiply_transpose' [ @{{.*}}ast.toy:28:11
# CHECK-NEXT: Call 'transpose' [ @{{.*}}ast.toy:28:30
# CHECK-NEXT: var: a @{{.*}}ast.toy:28:40
# CHECK-NEXT: ]
# CHECK-NEXT: var: c @{{.*}}ast.toy:27:44
# CHECK-NEXT: var: c @{{.*}}ast.toy:28:44
# CHECK-NEXT: ]