BUILD 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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_recur",
  31. "fun1",
  32. "fun2",
  33. "fun3",
  34. "fun4",
  35. "fun5",
  36. "fun6_fail_type",
  37. "funptr1",
  38. "global_variable1",
  39. "global_variable2",
  40. "global_variable3",
  41. "global_variable4",
  42. "global_variable5",
  43. "global_variable6",
  44. "global_variable7",
  45. "global_variable8",
  46. "if1",
  47. "if2",
  48. "if3",
  49. "match_int_default",
  50. "match_int",
  51. "match_type",
  52. "next",
  53. "pattern_init",
  54. "pattern_variable_fail",
  55. "record1",
  56. "struct1",
  57. "struct2",
  58. "struct3",
  59. "tuple_assign",
  60. "tuple_match",
  61. "tuple1",
  62. "tuple2",
  63. "while1",
  64. "zero",
  65. "experimental_continuation1",
  66. "experimental_continuation2",
  67. "experimental_continuation3",
  68. "experimental_continuation4",
  69. "experimental_continuation5",
  70. "experimental_continuation6",
  71. "experimental_continuation7",
  72. "experimental_continuation8",
  73. "experimental_continuation9",
  74. ]
  75. [genrule(
  76. name = "%s_out" % e,
  77. srcs = ["testdata/%s.6c" % e],
  78. outs = ["testdata/%s.out" % e],
  79. # Suppress command errors.
  80. cmd = "$(location executable_semantics) $< > $@ 2>&1 || echo EXIT CODE: $$? >> $@",
  81. tools = [":executable_semantics"],
  82. ) for e in EXAMPLES]
  83. [golden_test(
  84. name = "%s_test" % e,
  85. golden = "testdata/%s.golden" % e,
  86. subject = "testdata/%s.out" % e,
  87. ) for e in EXAMPLES]