erick-alcachofa b99f3586dc
chore(license): Added NOTICE header to all source files
Signed-off-by: erick-alcachofa <erick@artichoke.dev>
2025-12-25 13:12:41 -06:00

123 lines
3.2 KiB
C++

//============================================================================//
// //
// artichoke programming language //
// //
// Copyright (C) 2025 Erick Saul Guzman Ramos, whoami.artichoke.dev //
// //
// //
// This program is free software: you can redistribute it and/or modify //
// it under the terms of the GNU Affero General Public License as published //
// by the Free Software Foundation, either version 3 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU Affero General Public License for more details. //
// //
// You should have received a copy of the GNU Affero General Public License //
// along with this program. If not, see <https://www.gnu.org/licenses/>. //
// //
//============================================================================//
#pragma once
#include <cstddef>
#include <memory>
#include <vector>
#include <string>
#include <variant>
#include <optional>
namespace arti::lang::ast {
struct SourceLocation {
std::size_t line;
std::size_t column;
};
enum class Mutability {
Uninitialized,
Mutable,
Constant,
};
enum class TypeQualifier {
Uninitialized,
Pointer,
Slice,
Mutable,
Optional,
};
enum class UnaryOperator {
Uninitialized,
Not,
Minus,
BitNot,
Ampersand,
Star,
};
enum class BinaryOperator {
Uninitialized,
Equal,
NotEqual,
GreaterThan,
LessThan,
GreaterEqual,
LessEqual,
BitAnd,
BitXor,
BitOr,
LeftShift,
RightShift,
Adition,
Substraction,
Multiplication,
Division,
Modulo,
BoolAnd,
BoolOr,
};
enum class CompoundAssignOperator {
Uninitialized,
Addition,
Substraction,
Multiplication,
Division,
Modulo,
BitAnd,
BitOr,
LeftShift,
RightShift,
BoolAnd,
BoolOr,
};
/* Alising of types for consistency */
using Boolean = bool;
using String = std::string;
template <typename T>
using Ptr = std::unique_ptr<T>;
template <typename T>
using Optional = std::optional<T>;
template <typename... T>
using Variant = std::variant<T...>;
template <typename T>
using Vector = std::vector<T>;
template <typename Node>
concept ASTNodePtr = requires {
typename Node::element_type;
requires std::is_same_v<std::unique_ptr<typename Node::element_type>, Node>;
};
} // namespace arti::lang::ast