expression.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655
  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. #ifndef EXECUTABLE_SEMANTICS_AST_EXPRESSION_H_
  5. #define EXECUTABLE_SEMANTICS_AST_EXPRESSION_H_
  6. #include <map>
  7. #include <optional>
  8. #include <string>
  9. #include <variant>
  10. #include <vector>
  11. #include "common/ostream.h"
  12. #include "executable_semantics/ast/ast_node.h"
  13. #include "executable_semantics/ast/paren_contents.h"
  14. #include "executable_semantics/ast/static_scope.h"
  15. #include "executable_semantics/ast/value_category.h"
  16. #include "executable_semantics/common/arena.h"
  17. #include "executable_semantics/common/source_location.h"
  18. #include "llvm/ADT/ArrayRef.h"
  19. #include "llvm/Support/Compiler.h"
  20. namespace Carbon {
  21. class Value;
  22. class VariableType;
  23. class ImplBinding;
  24. class Expression : public AstNode {
  25. public:
  26. ~Expression() override = 0;
  27. void Print(llvm::raw_ostream& out) const override;
  28. void PrintID(llvm::raw_ostream& out) const override;
  29. static auto classof(const AstNode* node) {
  30. return InheritsFromExpression(node->kind());
  31. }
  32. // Returns the enumerator corresponding to the most-derived type of this
  33. // object.
  34. auto kind() const -> ExpressionKind {
  35. return static_cast<ExpressionKind>(root_kind());
  36. }
  37. // The static type of this expression. Cannot be called before typechecking.
  38. auto static_type() const -> const Value& {
  39. CHECK(static_type_.has_value());
  40. return **static_type_;
  41. }
  42. // Sets the static type of this expression. Can only be called once, during
  43. // typechecking.
  44. void set_static_type(Nonnull<const Value*> type) {
  45. CHECK(!static_type_.has_value());
  46. static_type_ = type;
  47. }
  48. // The value category of this expression. Cannot be called before
  49. // typechecking.
  50. auto value_category() const -> ValueCategory { return *value_category_; }
  51. // Sets the value category of this expression. Can be called multiple times,
  52. // but the argument must have the same value each time.
  53. void set_value_category(ValueCategory value_category) {
  54. CHECK(!value_category_.has_value() || value_category == *value_category_);
  55. value_category_ = value_category;
  56. }
  57. protected:
  58. // Constructs an Expression representing syntax at the given line number.
  59. // `kind` must be the enumerator corresponding to the most-derived type being
  60. // constructed.
  61. Expression(AstNodeKind kind, SourceLocation source_loc)
  62. : AstNode(kind, source_loc) {}
  63. private:
  64. std::optional<Nonnull<const Value*>> static_type_;
  65. std::optional<ValueCategory> value_category_;
  66. };
  67. // A FieldInitializer represents the initialization of a single struct field.
  68. class FieldInitializer {
  69. public:
  70. FieldInitializer(std::string name, Nonnull<Expression*> expression)
  71. : name_(std::move(name)), expression_(expression) {}
  72. auto name() const -> const std::string& { return name_; }
  73. auto expression() const -> const Expression& { return *expression_; }
  74. auto expression() -> Expression& { return *expression_; }
  75. private:
  76. // The field name. Cannot be empty.
  77. std::string name_;
  78. // The expression that initializes the field.
  79. Nonnull<Expression*> expression_;
  80. };
  81. enum class Operator {
  82. Add,
  83. AddressOf,
  84. And,
  85. Deref,
  86. Eq,
  87. Mul,
  88. Neg,
  89. Not,
  90. Or,
  91. Sub,
  92. Ptr,
  93. };
  94. // Returns the lexical representation of `op`, such as "+" for `Add`.
  95. auto ToString(Operator op) -> std::string_view;
  96. class IdentifierExpression : public Expression {
  97. public:
  98. explicit IdentifierExpression(SourceLocation source_loc, std::string name)
  99. : Expression(AstNodeKind::IdentifierExpression, source_loc),
  100. name_(std::move(name)) {}
  101. static auto classof(const AstNode* node) -> bool {
  102. return InheritsFromIdentifierExpression(node->kind());
  103. }
  104. auto name() const -> const std::string& { return name_; }
  105. // Returns the ValueNodeView this identifier refers to. Cannot be called
  106. // before name resolution.
  107. auto value_node() const -> const ValueNodeView& { return *value_node_; }
  108. // Sets the value returned by value_node. Can be called only once,
  109. // during name resolution.
  110. void set_value_node(ValueNodeView value_node) {
  111. CHECK(!value_node_.has_value());
  112. value_node_ = std::move(value_node);
  113. }
  114. private:
  115. std::string name_;
  116. std::optional<ValueNodeView> value_node_;
  117. };
  118. class FieldAccessExpression : public Expression {
  119. public:
  120. explicit FieldAccessExpression(SourceLocation source_loc,
  121. Nonnull<Expression*> aggregate,
  122. std::string field)
  123. : Expression(AstNodeKind::FieldAccessExpression, source_loc),
  124. aggregate_(aggregate),
  125. field_(std::move(field)) {}
  126. static auto classof(const AstNode* node) -> bool {
  127. return InheritsFromFieldAccessExpression(node->kind());
  128. }
  129. auto aggregate() const -> const Expression& { return *aggregate_; }
  130. auto aggregate() -> Expression& { return *aggregate_; }
  131. auto field() const -> const std::string& { return field_; }
  132. // If `aggregate` has a generic type, returns the `ImplBinding` that
  133. // identifies its witness table. Otherwise, returns `std::nullopt`. Should not
  134. // be called before typechecking.
  135. auto impl() const -> std::optional<Nonnull<const ImplBinding*>> {
  136. return impl_;
  137. }
  138. // Can only be called once, during typechecking.
  139. void set_impl(Nonnull<const ImplBinding*> impl) {
  140. CHECK(!impl_.has_value());
  141. impl_ = impl;
  142. }
  143. private:
  144. Nonnull<Expression*> aggregate_;
  145. std::string field_;
  146. std::optional<Nonnull<const ImplBinding*>> impl_;
  147. };
  148. class IndexExpression : public Expression {
  149. public:
  150. explicit IndexExpression(SourceLocation source_loc,
  151. Nonnull<Expression*> aggregate,
  152. Nonnull<Expression*> offset)
  153. : Expression(AstNodeKind::IndexExpression, source_loc),
  154. aggregate_(aggregate),
  155. offset_(offset) {}
  156. static auto classof(const AstNode* node) -> bool {
  157. return InheritsFromIndexExpression(node->kind());
  158. }
  159. auto aggregate() const -> const Expression& { return *aggregate_; }
  160. auto aggregate() -> Expression& { return *aggregate_; }
  161. auto offset() const -> const Expression& { return *offset_; }
  162. auto offset() -> Expression& { return *offset_; }
  163. private:
  164. Nonnull<Expression*> aggregate_;
  165. Nonnull<Expression*> offset_;
  166. };
  167. class IntLiteral : public Expression {
  168. public:
  169. explicit IntLiteral(SourceLocation source_loc, int value)
  170. : Expression(AstNodeKind::IntLiteral, source_loc), value_(value) {}
  171. static auto classof(const AstNode* node) -> bool {
  172. return InheritsFromIntLiteral(node->kind());
  173. }
  174. auto value() const -> int { return value_; }
  175. private:
  176. int value_;
  177. };
  178. class BoolLiteral : public Expression {
  179. public:
  180. explicit BoolLiteral(SourceLocation source_loc, bool value)
  181. : Expression(AstNodeKind::BoolLiteral, source_loc), value_(value) {}
  182. static auto classof(const AstNode* node) -> bool {
  183. return InheritsFromBoolLiteral(node->kind());
  184. }
  185. auto value() const -> bool { return value_; }
  186. private:
  187. bool value_;
  188. };
  189. class StringLiteral : public Expression {
  190. public:
  191. explicit StringLiteral(SourceLocation source_loc, std::string value)
  192. : Expression(AstNodeKind::StringLiteral, source_loc),
  193. value_(std::move(value)) {}
  194. static auto classof(const AstNode* node) -> bool {
  195. return InheritsFromStringLiteral(node->kind());
  196. }
  197. auto value() const -> const std::string& { return value_; }
  198. private:
  199. std::string value_;
  200. };
  201. class StringTypeLiteral : public Expression {
  202. public:
  203. explicit StringTypeLiteral(SourceLocation source_loc)
  204. : Expression(AstNodeKind::StringTypeLiteral, source_loc) {}
  205. static auto classof(const AstNode* node) -> bool {
  206. return InheritsFromStringTypeLiteral(node->kind());
  207. }
  208. };
  209. class TupleLiteral : public Expression {
  210. public:
  211. explicit TupleLiteral(SourceLocation source_loc)
  212. : TupleLiteral(source_loc, {}) {}
  213. explicit TupleLiteral(SourceLocation source_loc,
  214. std::vector<Nonnull<Expression*>> fields)
  215. : Expression(AstNodeKind::TupleLiteral, source_loc),
  216. fields_(std::move(fields)) {}
  217. static auto classof(const AstNode* node) -> bool {
  218. return InheritsFromTupleLiteral(node->kind());
  219. }
  220. auto fields() const -> llvm::ArrayRef<Nonnull<const Expression*>> {
  221. return fields_;
  222. }
  223. auto fields() -> llvm::ArrayRef<Nonnull<Expression*>> { return fields_; }
  224. private:
  225. std::vector<Nonnull<Expression*>> fields_;
  226. };
  227. // A non-empty literal value of a struct type.
  228. //
  229. // It can't be empty because the syntax `{}` is a struct type literal as well
  230. // as a literal value of that type, so for consistency we always represent it
  231. // as a StructTypeLiteral rather than let it oscillate unpredictably between
  232. // the two.
  233. class StructLiteral : public Expression {
  234. public:
  235. explicit StructLiteral(SourceLocation loc,
  236. std::vector<FieldInitializer> fields)
  237. : Expression(AstNodeKind::StructLiteral, loc),
  238. fields_(std::move(fields)) {
  239. CHECK(!fields_.empty())
  240. << "`{}` is represented as a StructTypeLiteral, not a StructLiteral.";
  241. }
  242. static auto classof(const AstNode* node) -> bool {
  243. return InheritsFromStructLiteral(node->kind());
  244. }
  245. auto fields() const -> llvm::ArrayRef<FieldInitializer> { return fields_; }
  246. auto fields() -> llvm::MutableArrayRef<FieldInitializer> { return fields_; }
  247. private:
  248. std::vector<FieldInitializer> fields_;
  249. };
  250. // A literal representing a struct type.
  251. //
  252. // Code that handles this type may sometimes need to have special-case handling
  253. // for `{}`, which is a struct value in addition to being a struct type.
  254. class StructTypeLiteral : public Expression {
  255. public:
  256. explicit StructTypeLiteral(SourceLocation loc) : StructTypeLiteral(loc, {}) {}
  257. explicit StructTypeLiteral(SourceLocation loc,
  258. std::vector<FieldInitializer> fields)
  259. : Expression(AstNodeKind::StructTypeLiteral, loc),
  260. fields_(std::move(fields)) {}
  261. static auto classof(const AstNode* node) -> bool {
  262. return InheritsFromStructTypeLiteral(node->kind());
  263. }
  264. auto fields() const -> llvm::ArrayRef<FieldInitializer> { return fields_; }
  265. auto fields() -> llvm::MutableArrayRef<FieldInitializer> { return fields_; }
  266. private:
  267. std::vector<FieldInitializer> fields_;
  268. };
  269. class PrimitiveOperatorExpression : public Expression {
  270. public:
  271. explicit PrimitiveOperatorExpression(
  272. SourceLocation source_loc, Operator op,
  273. std::vector<Nonnull<Expression*>> arguments)
  274. : Expression(AstNodeKind::PrimitiveOperatorExpression, source_loc),
  275. op_(op),
  276. arguments_(std::move(arguments)) {}
  277. static auto classof(const AstNode* node) -> bool {
  278. return InheritsFromPrimitiveOperatorExpression(node->kind());
  279. }
  280. auto op() const -> Operator { return op_; }
  281. auto arguments() const -> llvm::ArrayRef<Nonnull<Expression*>> {
  282. return arguments_;
  283. }
  284. auto arguments() -> llvm::MutableArrayRef<Nonnull<Expression*>> {
  285. return arguments_;
  286. }
  287. private:
  288. Operator op_;
  289. std::vector<Nonnull<Expression*>> arguments_;
  290. };
  291. class GenericBinding;
  292. using BindingMap =
  293. std::map<Nonnull<const GenericBinding*>, Nonnull<const Value*>>;
  294. using ImplExpMap = std::map<Nonnull<const ImplBinding*>, Nonnull<Expression*>>;
  295. class CallExpression : public Expression {
  296. public:
  297. explicit CallExpression(SourceLocation source_loc,
  298. Nonnull<Expression*> function,
  299. Nonnull<Expression*> argument)
  300. : Expression(AstNodeKind::CallExpression, source_loc),
  301. function_(function),
  302. argument_(argument) {}
  303. static auto classof(const AstNode* node) -> bool {
  304. return InheritsFromCallExpression(node->kind());
  305. }
  306. auto function() const -> const Expression& { return *function_; }
  307. auto function() -> Expression& { return *function_; }
  308. auto argument() const -> const Expression& { return *argument_; }
  309. auto argument() -> Expression& { return *argument_; }
  310. // Maps each of `function`'s impl bindings to an expression
  311. // that constructs a witness table.
  312. // Should not be called before typechecking, or if `function` is not
  313. // a generic function.
  314. auto impls() const -> const ImplExpMap& { return impls_; }
  315. // Can only be called once, during typechecking.
  316. void set_impls(const ImplExpMap& impls) {
  317. CHECK(impls_.empty());
  318. impls_ = impls;
  319. }
  320. auto deduced_args() const -> const BindingMap& { return deduced_args_; }
  321. void set_deduced_args(const BindingMap& deduced_args) {
  322. deduced_args_ = deduced_args;
  323. }
  324. private:
  325. Nonnull<Expression*> function_;
  326. Nonnull<Expression*> argument_;
  327. ImplExpMap impls_;
  328. BindingMap deduced_args_;
  329. };
  330. class FunctionTypeLiteral : public Expression {
  331. public:
  332. explicit FunctionTypeLiteral(SourceLocation source_loc,
  333. Nonnull<Expression*> parameter,
  334. Nonnull<Expression*> return_type)
  335. : Expression(AstNodeKind::FunctionTypeLiteral, source_loc),
  336. parameter_(parameter),
  337. return_type_(return_type) {}
  338. static auto classof(const AstNode* node) -> bool {
  339. return InheritsFromFunctionTypeLiteral(node->kind());
  340. }
  341. auto parameter() const -> const Expression& { return *parameter_; }
  342. auto parameter() -> Expression& { return *parameter_; }
  343. auto return_type() const -> const Expression& { return *return_type_; }
  344. auto return_type() -> Expression& { return *return_type_; }
  345. private:
  346. Nonnull<Expression*> parameter_;
  347. Nonnull<Expression*> return_type_;
  348. };
  349. class BoolTypeLiteral : public Expression {
  350. public:
  351. explicit BoolTypeLiteral(SourceLocation source_loc)
  352. : Expression(AstNodeKind::BoolTypeLiteral, source_loc) {}
  353. static auto classof(const AstNode* node) -> bool {
  354. return InheritsFromBoolTypeLiteral(node->kind());
  355. }
  356. };
  357. class IntTypeLiteral : public Expression {
  358. public:
  359. explicit IntTypeLiteral(SourceLocation source_loc)
  360. : Expression(AstNodeKind::IntTypeLiteral, source_loc) {}
  361. static auto classof(const AstNode* node) -> bool {
  362. return InheritsFromIntTypeLiteral(node->kind());
  363. }
  364. };
  365. class ContinuationTypeLiteral : public Expression {
  366. public:
  367. explicit ContinuationTypeLiteral(SourceLocation source_loc)
  368. : Expression(AstNodeKind::ContinuationTypeLiteral, source_loc) {}
  369. static auto classof(const AstNode* node) -> bool {
  370. return InheritsFromContinuationTypeLiteral(node->kind());
  371. }
  372. };
  373. class TypeTypeLiteral : public Expression {
  374. public:
  375. explicit TypeTypeLiteral(SourceLocation source_loc)
  376. : Expression(AstNodeKind::TypeTypeLiteral, source_loc) {}
  377. static auto classof(const AstNode* node) -> bool {
  378. return InheritsFromTypeTypeLiteral(node->kind());
  379. }
  380. };
  381. class IntrinsicExpression : public Expression {
  382. public:
  383. enum class Intrinsic {
  384. Print,
  385. };
  386. // Returns the enumerator corresponding to the intrinsic named `name`,
  387. // or raises a fatal compile error if there is no such enumerator.
  388. static auto FindIntrinsic(std::string_view name, SourceLocation source_loc)
  389. -> ErrorOr<Intrinsic>;
  390. explicit IntrinsicExpression(Intrinsic intrinsic, Nonnull<TupleLiteral*> args,
  391. SourceLocation source_loc)
  392. : Expression(AstNodeKind::IntrinsicExpression, source_loc),
  393. intrinsic_(intrinsic),
  394. args_(args) {}
  395. static auto classof(const AstNode* node) -> bool {
  396. return InheritsFromIntrinsicExpression(node->kind());
  397. }
  398. auto intrinsic() const -> Intrinsic { return intrinsic_; }
  399. auto args() const -> const TupleLiteral& { return *args_; }
  400. auto args() -> TupleLiteral& { return *args_; }
  401. private:
  402. Intrinsic intrinsic_;
  403. Nonnull<TupleLiteral*> args_;
  404. };
  405. class IfExpression : public Expression {
  406. public:
  407. explicit IfExpression(SourceLocation source_loc,
  408. Nonnull<Expression*> condition,
  409. Nonnull<Expression*> then_expression,
  410. Nonnull<Expression*> else_expression)
  411. : Expression(AstNodeKind::IfExpression, source_loc),
  412. condition_(condition),
  413. then_expression_(then_expression),
  414. else_expression_(else_expression) {}
  415. static auto classof(const AstNode* node) -> bool {
  416. return InheritsFromIfExpression(node->kind());
  417. }
  418. auto condition() const -> const Expression& { return *condition_; }
  419. auto condition() -> Expression& { return *condition_; }
  420. auto then_expression() const -> const Expression& {
  421. return *then_expression_;
  422. }
  423. auto then_expression() -> Expression& { return *then_expression_; }
  424. auto else_expression() const -> const Expression& {
  425. return *else_expression_;
  426. }
  427. auto else_expression() -> Expression& { return *else_expression_; }
  428. private:
  429. Nonnull<Expression*> condition_;
  430. Nonnull<Expression*> then_expression_;
  431. Nonnull<Expression*> else_expression_;
  432. };
  433. // Instantiate a generic impl.
  434. class InstantiateImpl : public Expression {
  435. public:
  436. using ImplementsCarbonValueNode = void;
  437. explicit InstantiateImpl(SourceLocation source_loc,
  438. Nonnull<Expression*> generic_impl,
  439. const BindingMap& type_args, const ImplExpMap& impls)
  440. : Expression(AstNodeKind::InstantiateImpl, source_loc),
  441. generic_impl_(generic_impl),
  442. type_args_(type_args),
  443. impls_(impls) {}
  444. static auto classof(const AstNode* node) -> bool {
  445. return InheritsFromInstantiateImpl(node->kind());
  446. }
  447. auto generic_impl() const -> Nonnull<Expression*> { return generic_impl_; }
  448. auto type_args() const -> const BindingMap& { return type_args_; }
  449. // Maps each of the impl bindings to an expression that constructs
  450. // the witness table for that impl.
  451. auto impls() const -> const ImplExpMap& { return impls_; }
  452. private:
  453. Nonnull<Expression*> generic_impl_;
  454. BindingMap type_args_;
  455. ImplExpMap impls_;
  456. };
  457. // An expression whose semantics have not been implemented. This can be used
  458. // as a placeholder during development, in order to implement and test parsing
  459. // of a new expression syntax without having to implement its semantics.
  460. class UnimplementedExpression : public Expression {
  461. public:
  462. // Constructs an UnimplementedExpression with the given label and the given
  463. // children, which must all be convertible to Nonnull<AstNode*>. The label
  464. // should correspond roughly to the name of the class that will eventually
  465. // replace this usage of UnimplementedExpression.
  466. template <typename... Children>
  467. UnimplementedExpression(SourceLocation source_loc, std::string label,
  468. Children... children)
  469. : Expression(AstNodeKind::UnimplementedExpression, source_loc),
  470. label_(std::move(label)) {
  471. AddChildren(children...);
  472. }
  473. static auto classof(const AstNode* node) -> bool {
  474. return InheritsFromUnimplementedExpression(node->kind());
  475. }
  476. auto label() const -> std::string_view { return label_; }
  477. auto children() const -> llvm::ArrayRef<Nonnull<const AstNode*>> {
  478. return children_;
  479. }
  480. private:
  481. void AddChildren() {}
  482. template <typename... Children>
  483. void AddChildren(Nonnull<AstNode*> child, Children... children) {
  484. children_.push_back(child);
  485. AddChildren(children...);
  486. }
  487. std::string label_;
  488. std::vector<Nonnull<AstNode*>> children_;
  489. };
  490. // A literal representing a statically-sized array type.
  491. class ArrayTypeLiteral : public Expression {
  492. public:
  493. // Constructs an array type literal which uses the given expressions to
  494. // represent the element type and size.
  495. ArrayTypeLiteral(SourceLocation source_loc,
  496. Nonnull<Expression*> element_type_expression,
  497. Nonnull<Expression*> size_expression)
  498. : Expression(AstNodeKind::ArrayTypeLiteral, source_loc),
  499. element_type_expression_(element_type_expression),
  500. size_expression_(size_expression) {}
  501. static auto classof(const AstNode* node) -> bool {
  502. return InheritsFromArrayTypeLiteral(node->kind());
  503. }
  504. auto element_type_expression() const -> const Expression& {
  505. return *element_type_expression_;
  506. }
  507. auto element_type_expression() -> Expression& {
  508. return *element_type_expression_;
  509. }
  510. auto size_expression() const -> const Expression& {
  511. return *size_expression_;
  512. }
  513. auto size_expression() -> Expression& { return *size_expression_; }
  514. private:
  515. Nonnull<Expression*> element_type_expression_;
  516. Nonnull<Expression*> size_expression_;
  517. };
  518. // Converts paren_contents to an Expression, interpreting the parentheses as
  519. // grouping if their contents permit that interpretation, or as forming a
  520. // tuple otherwise.
  521. auto ExpressionFromParenContents(
  522. Nonnull<Arena*> arena, SourceLocation source_loc,
  523. const ParenContents<Expression>& paren_contents) -> Nonnull<Expression*>;
  524. // Converts paren_contents to an Expression, interpreting the parentheses as
  525. // forming a tuple.
  526. auto TupleExpressionFromParenContents(
  527. Nonnull<Arena*> arena, SourceLocation source_loc,
  528. const ParenContents<Expression>& paren_contents) -> Nonnull<TupleLiteral*>;
  529. } // namespace Carbon
  530. #endif // EXECUTABLE_SEMANTICS_AST_EXPRESSION_H_