mirror of
https://codeberg.org/ProgramSnail/lang_2023.git
synced 2026-01-05 06:18:32 +00:00
.
This commit is contained in:
parent
66a5dcfb4a
commit
05eccf3a2e
5 changed files with 21 additions and 27 deletions
|
|
@ -17,26 +17,6 @@ namespace interpreter {
|
|||
|
||||
namespace info {
|
||||
|
||||
using NumberValue = long long;
|
||||
using FloatNumberValue = float;
|
||||
using StringValue = std::string;
|
||||
|
||||
struct SimpleValue {
|
||||
std::variant<NumberValue, FloatNumberValue, StringValue> value;
|
||||
};
|
||||
|
||||
struct Value {
|
||||
enum class ValueStructure {
|
||||
Simple, // one value
|
||||
Variant, // one value from list, can have arguments
|
||||
// MultiVariant, // constructed variant // ??
|
||||
Tuple, // tuple of values
|
||||
};
|
||||
ValueStructure structure;
|
||||
std::vector<std::variant<SimpleValue, Value>> values;
|
||||
};
|
||||
// better variant value storage (then string) ??
|
||||
|
||||
struct VariantTypeInfo;
|
||||
struct TupleTypeInfo;
|
||||
struct AliasTypeInfo;
|
||||
|
|
@ -49,16 +29,17 @@ enum class BuiltInTypeInfo {
|
|||
StringT,
|
||||
IntT,
|
||||
FloatT,
|
||||
UnitT,
|
||||
};
|
||||
|
||||
struct TypeUsageInfo {
|
||||
interpreter::tokens::ParametrizedType* node;
|
||||
interpreter::tokens::TypeExpression* node;
|
||||
TypeInfo* info = nullptr;
|
||||
};
|
||||
|
||||
struct ParameterInfo {
|
||||
std::string type;
|
||||
std::vector<interpreter::tokens::TypeclassUsage*> typeclass_nodes;
|
||||
std::vector<interpreter::tokens::TypeclassExpression*> typeclass_nodes;
|
||||
std::vector<TypeclassInfo*> typeclass_types;
|
||||
};
|
||||
|
||||
|
|
@ -79,7 +60,9 @@ struct AnyTypeInfo {
|
|||
interpreter::tokens::AnyType* value;
|
||||
};
|
||||
|
||||
struct TypeInfo { std::variant<AbstractTypeInfo, AliasTypeInfo, AnyTypeInfo> type; };
|
||||
struct TypeInfo {
|
||||
std::variant<AbstractTypeInfo, AliasTypeInfo, AnyTypeInfo> type;
|
||||
};
|
||||
|
||||
struct ConstructorInfo {
|
||||
std::string name;
|
||||
|
|
@ -122,6 +105,7 @@ struct NamespaceInfo {
|
|||
std::unordered_map<std::string, utils::IdType> types;
|
||||
std::unordered_map<std::string, utils::IdType> typeclasses;
|
||||
std::unordered_map<std::string, utils::IdType> functions;
|
||||
std::unordered_map<std::string, utils::IdType> constructors;
|
||||
std::unordered_map<std::string, NamespaceInfo> namespaces;
|
||||
std::unordered_map<std::string, std::vector<NamespaceInfo>> variable_namespaces;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue