BUILD 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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. package(default_visibility = ["//executable_semantics:__subpackages__"])
  5. cc_library(
  6. name = "ast",
  7. hdrs = ["ast.h"],
  8. deps = [
  9. ":declaration",
  10. ":library_name",
  11. ],
  12. )
  13. cc_library(
  14. name = "ast_node",
  15. srcs = ["ast_node.cpp"],
  16. hdrs = [
  17. "ast_node.h",
  18. "ast_rtti.h",
  19. ],
  20. deps = [
  21. ":source_location",
  22. ],
  23. )
  24. genrule(
  25. name = "ast_rtti",
  26. srcs = ["ast_rtti.txt"],
  27. outs = ["ast_rtti.h"],
  28. cmd = "./$(location //executable_semantics:gen_rtti)" +
  29. " $(location ast_rtti.txt) > \"$@\"",
  30. tools = ["//executable_semantics:gen_rtti"],
  31. )
  32. cc_library(
  33. name = "ast_test_matchers",
  34. testonly = 1,
  35. srcs = [
  36. "ast_test_matchers_internal.cpp",
  37. "ast_test_matchers_internal.h",
  38. ],
  39. hdrs = ["ast_test_matchers.h"],
  40. deps = [
  41. ":ast",
  42. ":ast_node",
  43. ":declaration",
  44. ":expression",
  45. ":statement",
  46. "@com_google_googletest//:gtest",
  47. "@llvm-project//llvm:Support",
  48. ],
  49. )
  50. cc_test(
  51. name = "ast_test_matchers_test",
  52. srcs = ["ast_test_matchers_test.cpp"],
  53. deps = [
  54. ":ast_test_matchers",
  55. ":declaration",
  56. ":expression",
  57. ":pattern",
  58. ":statement",
  59. "//executable_semantics/common:arena",
  60. "@com_google_googletest//:gtest_main",
  61. ],
  62. )
  63. cc_library(
  64. name = "declaration",
  65. srcs = ["declaration.cpp"],
  66. hdrs = [
  67. "declaration.h",
  68. ],
  69. deps = [
  70. ":ast_node",
  71. ":member",
  72. ":pattern",
  73. ":source_location",
  74. ":statement",
  75. ":static_scope",
  76. "//common:ostream",
  77. "//executable_semantics/common:nonnull",
  78. "@llvm-project//llvm:Support",
  79. ],
  80. )
  81. cc_library(
  82. name = "expression",
  83. srcs = ["expression.cpp"],
  84. hdrs = ["expression.h"],
  85. deps = [
  86. ":ast_node",
  87. ":paren_contents",
  88. "//common:indirect_value",
  89. "//common:ostream",
  90. "//executable_semantics/common:arena",
  91. "//executable_semantics/common:error",
  92. "@llvm-project//llvm:Support",
  93. ],
  94. )
  95. cc_test(
  96. name = "expression_test",
  97. srcs = ["expression_test.cpp"],
  98. deps = [
  99. ":expression",
  100. ":paren_contents",
  101. "@com_google_googletest//:gtest_main",
  102. ],
  103. )
  104. cc_library(
  105. name = "member",
  106. srcs = ["member.cpp"],
  107. hdrs = ["member.h"],
  108. deps = [
  109. ":pattern",
  110. ":source_location",
  111. "//common:ostream",
  112. ],
  113. )
  114. cc_library(
  115. name = "library_name",
  116. hdrs = ["library_name.h"],
  117. )
  118. cc_library(
  119. name = "paren_contents",
  120. hdrs = ["paren_contents.h"],
  121. deps = [
  122. ":source_location",
  123. "//executable_semantics/common:error",
  124. ],
  125. )
  126. cc_library(
  127. name = "pattern",
  128. srcs = ["pattern.cpp"],
  129. hdrs = ["pattern.h"],
  130. deps = [
  131. ":ast_node",
  132. ":expression",
  133. ":source_location",
  134. ":static_scope",
  135. "//common:ostream",
  136. "//executable_semantics/common:arena",
  137. "//executable_semantics/common:error",
  138. "@llvm-project//llvm:Support",
  139. ],
  140. )
  141. cc_test(
  142. name = "pattern_test",
  143. srcs = ["pattern_test.cpp"],
  144. deps = [
  145. ":paren_contents",
  146. ":pattern",
  147. "@com_google_googletest//:gtest_main",
  148. "@llvm-project//llvm:Support",
  149. ],
  150. )
  151. cc_library(
  152. name = "static_scope",
  153. srcs = ["static_scope.cpp"],
  154. hdrs = ["static_scope.h"],
  155. deps = [
  156. ":ast_node",
  157. ":source_location",
  158. "//executable_semantics/common:arena",
  159. "//executable_semantics/common:error",
  160. ],
  161. )
  162. cc_library(
  163. name = "source_location",
  164. hdrs = ["source_location.h"],
  165. deps = [
  166. "//common:ostream",
  167. "//executable_semantics/common:nonnull",
  168. ],
  169. )
  170. cc_library(
  171. name = "statement",
  172. srcs = ["statement.cpp"],
  173. hdrs = ["statement.h"],
  174. deps = [
  175. ":ast_node",
  176. ":expression",
  177. ":pattern",
  178. ":source_location",
  179. "//common:check",
  180. "//common:ostream",
  181. "//executable_semantics/common:arena",
  182. "@llvm-project//llvm:Support",
  183. ],
  184. )