BUILD 4.9 KB

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