BUILD 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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. ":pattern",
  74. ":return_term",
  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 = "return_term",
  86. hdrs = ["return_term.h"],
  87. deps = [
  88. ":expression",
  89. ":source_location",
  90. "//common:check",
  91. "//common:ostream",
  92. "//executable_semantics/common:nonnull",
  93. "@llvm-project//llvm:Support",
  94. ],
  95. )
  96. cc_library(
  97. name = "expression",
  98. srcs = ["expression.cpp"],
  99. hdrs = ["expression.h"],
  100. deps = [
  101. ":ast_node",
  102. ":paren_contents",
  103. ":source_location",
  104. ":static_scope",
  105. ":value_category",
  106. "//common:indirect_value",
  107. "//common:ostream",
  108. "//executable_semantics/common:arena",
  109. "//executable_semantics/common:error",
  110. "@llvm-project//llvm:Support",
  111. ],
  112. )
  113. cc_test(
  114. name = "expression_test",
  115. srcs = ["expression_test.cpp"],
  116. deps = [
  117. ":expression",
  118. ":paren_contents",
  119. "//executable_semantics/common:arena",
  120. "@com_google_googletest//:gtest_main",
  121. "@llvm-project//llvm:Support",
  122. ],
  123. )
  124. cc_library(
  125. name = "library_name",
  126. hdrs = ["library_name.h"],
  127. )
  128. cc_library(
  129. name = "paren_contents",
  130. hdrs = ["paren_contents.h"],
  131. deps = [
  132. ":source_location",
  133. "//executable_semantics/common:error",
  134. ],
  135. )
  136. cc_library(
  137. name = "pattern",
  138. srcs = ["pattern.cpp"],
  139. hdrs = ["pattern.h"],
  140. deps = [
  141. ":ast_node",
  142. ":expression",
  143. ":source_location",
  144. ":static_scope",
  145. ":value_category",
  146. "//common:ostream",
  147. "//executable_semantics/common:arena",
  148. "//executable_semantics/common:error",
  149. "@llvm-project//llvm:Support",
  150. ],
  151. )
  152. cc_test(
  153. name = "pattern_test",
  154. srcs = ["pattern_test.cpp"],
  155. deps = [
  156. ":expression",
  157. ":paren_contents",
  158. ":pattern",
  159. "//executable_semantics/common:arena",
  160. "@com_google_googletest//:gtest_main",
  161. "@llvm-project//llvm:Support",
  162. ],
  163. )
  164. cc_library(
  165. name = "static_scope",
  166. srcs = ["static_scope.cpp"],
  167. hdrs = ["static_scope.h"],
  168. deps = [
  169. ":ast_node",
  170. ":source_location",
  171. ":value_category",
  172. "//common:check",
  173. "//executable_semantics/common:error",
  174. "//executable_semantics/common:nonnull",
  175. ],
  176. )
  177. cc_library(
  178. name = "source_location",
  179. hdrs = ["source_location.h"],
  180. deps = [
  181. "//common:ostream",
  182. "//executable_semantics/common:nonnull",
  183. ],
  184. )
  185. cc_library(
  186. name = "statement",
  187. srcs = ["statement.cpp"],
  188. hdrs = ["statement.h"],
  189. deps = [
  190. ":ast_node",
  191. ":expression",
  192. ":pattern",
  193. ":return_term",
  194. ":source_location",
  195. ":static_scope",
  196. ":value_category",
  197. "//common:check",
  198. "//common:ostream",
  199. "//executable_semantics/common:arena",
  200. "@llvm-project//llvm:Support",
  201. ],
  202. )
  203. cc_library(
  204. name = "value_category",
  205. hdrs = ["value_category.h"],
  206. )