BUILD 4.2 KB

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