BUILD 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. # Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. # Exceptions. See /LICENSE for license information.
  3. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. # TODO(https://github.com/carbon-language/carbon-lang/issues/266):
  5. # Migrate bison/flex usage to a more hermetic bazel build.
  6. load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
  7. load("//bazel/testing:golden_test.bzl", "golden_test")
  8. cc_binary(
  9. name = "executable_semantics",
  10. srcs = ["main.cpp"],
  11. deps = [
  12. "//executable_semantics/syntax",
  13. "@llvm-project//llvm:Support",
  14. ],
  15. )
  16. cc_library(
  17. name = "tracing_flag",
  18. srcs = ["tracing_flag.cpp"],
  19. hdrs = ["tracing_flag.h"],
  20. visibility = ["//executable_semantics:__subpackages__"],
  21. )
  22. EXAMPLES = [
  23. "assignment_copy1",
  24. "assignment_copy2",
  25. "block1",
  26. "block2",
  27. "break1",
  28. "choice1",
  29. "continue1",
  30. "fun_named_params",
  31. "fun_named_params2",
  32. "fun_recur",
  33. "fun1",
  34. "fun2",
  35. "fun3",
  36. "fun4",
  37. "fun5",
  38. "fun6_fail_type",
  39. "funptr1",
  40. "global_variable1",
  41. "global_variable2",
  42. "global_variable3",
  43. "global_variable4",
  44. "global_variable5",
  45. "global_variable6",
  46. "global_variable7",
  47. "global_variable8",
  48. "if1",
  49. "if2",
  50. "if3",
  51. "match_any_int",
  52. "match_int_default",
  53. "match_int",
  54. "match_type",
  55. "next",
  56. "pattern_init",
  57. "pattern_variable_fail",
  58. "record1",
  59. "struct1",
  60. "struct2",
  61. "struct3",
  62. "tuple_assign",
  63. "tuple_equality",
  64. "tuple_equality2",
  65. "tuple_equality3",
  66. "tuple_match",
  67. "tuple_match2",
  68. "tuple_match3",
  69. "tuple1",
  70. "tuple2",
  71. "tuple3",
  72. "tuple4",
  73. "tuple5",
  74. "while1",
  75. "zero",
  76. "experimental_continuation1",
  77. "experimental_continuation2",
  78. "experimental_continuation3",
  79. "experimental_continuation4",
  80. "experimental_continuation5",
  81. "experimental_continuation6",
  82. "experimental_continuation7",
  83. "experimental_continuation8",
  84. "experimental_continuation9",
  85. ]
  86. [genrule(
  87. name = "%s_out" % e,
  88. srcs = ["testdata/%s.6c" % e],
  89. outs = ["testdata/%s.out" % e],
  90. # Suppress command errors.
  91. cmd = "$(location executable_semantics) $< > $@ 2>&1 || echo EXIT CODE: $$? >> $@",
  92. tools = [":executable_semantics"],
  93. ) for e in EXAMPLES]
  94. [golden_test(
  95. name = "%s_test" % e,
  96. golden = "testdata/%s.golden" % e,
  97. subject = "testdata/%s.out" % e,
  98. ) for e in EXAMPLES]