From 541cb3fb47c9a396b10bbcebca10ada96bbc3b07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Fri, 13 Apr 2018 15:48:03 +0200 Subject: [PATCH] Add domain specifier to variable declarations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With this change, the domain of variable declarations can be specified. Variables can have the integer domain, in which case additional integer- specific simplification rules apply. Aside from that, the noninteger domain represents precomputed values. An additional “unknown” domain is introduced to flag variable domains prior to determining whether they are integer or not. --- include/anthem/AST.h | 2 ++ include/anthem/Utils.h | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/include/anthem/AST.h b/include/anthem/AST.h index 41b0865..87c20d1 100644 --- a/include/anthem/AST.h +++ b/include/anthem/AST.h @@ -2,6 +2,7 @@ #define __ANTHEM__AST_H #include +#include namespace anthem { @@ -369,6 +370,7 @@ struct VariableDeclaration VariableDeclaration &operator=(VariableDeclaration &&other) = default; Type type; + Domain domain{Domain::Unknown}; std::string name; }; diff --git a/include/anthem/Utils.h b/include/anthem/Utils.h index 0c4f472..58c9dcf 100644 --- a/include/anthem/Utils.h +++ b/include/anthem/Utils.h @@ -33,6 +33,15 @@ enum class OperationResult //////////////////////////////////////////////////////////////////////////////////////////////////// +enum class Domain +{ + Noninteger, + Integer, + Unknown, +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////// + } #endif