mirror of
https://codeberg.org/ProgramSnail/lang_2023.git
synced 2025-12-05 22:48:42 +00:00
extended name removed, dereference added, unary operators removed, fixes
This commit is contained in:
parent
e62144feac
commit
79bd30c1ee
20 changed files with 101 additions and 274 deletions
|
|
@ -79,7 +79,6 @@ private:
|
|||
// Operators
|
||||
|
||||
void Visit(BinaryOperatorExpression* node) override;
|
||||
void Visit(UnaryOperatorExpression* node) override;
|
||||
void Visit(ReferenceExpression* node) override;
|
||||
void Visit(AccessExpression* node) override;
|
||||
|
||||
|
|
@ -130,8 +129,6 @@ private:
|
|||
|
||||
// Identifiers, constants, etc. -----------------
|
||||
|
||||
void Visit(ExtendedName* node) override;
|
||||
|
||||
// // void Visit(AnyIdentifier* node) override; // std::string
|
||||
|
||||
void Visit(FloatNumberLiteral* node) override;
|
||||
|
|
|
|||
|
|
@ -81,7 +81,6 @@ private:
|
|||
// Operators
|
||||
|
||||
void Visit(BinaryOperatorExpression* node) override;
|
||||
void Visit(UnaryOperatorExpression* node) override;
|
||||
void Visit(ReferenceExpression* node) override;
|
||||
void Visit(AccessExpression* node) override;
|
||||
|
||||
|
|
@ -128,8 +127,6 @@ private:
|
|||
|
||||
// Identifiers, constants, etc. -----------------
|
||||
|
||||
// // void Visit(ExtendedName* node) override;
|
||||
|
||||
// // void Visit(std::string* node) override; // std::string
|
||||
|
||||
void Visit(FloatNumberLiteral* node) override;
|
||||
|
|
|
|||
|
|
@ -63,7 +63,6 @@ private:
|
|||
// Operators
|
||||
|
||||
// // void Visit(BinaryOperatorExpression* node) override;
|
||||
// // void Visit(UnaryOperatorExpression* node) override;
|
||||
// // void Visit(ReferenceExpression* node) override;
|
||||
// // void Visit(AccessExpression* node) override;
|
||||
|
||||
|
|
@ -110,8 +109,6 @@ private:
|
|||
|
||||
// Identifiers, constants, etc. -----------------
|
||||
|
||||
// // void Visit(ExtendedName* node) override;
|
||||
|
||||
// // void Visit(std::string* node) override; // std::string
|
||||
|
||||
// // void Visit(FloatNumberLiteral* node) override;
|
||||
|
|
|
|||
|
|
@ -151,12 +151,10 @@ using PrefixedExpression = std::variant<
|
|||
//
|
||||
struct LambdaFunction;
|
||||
struct TypeConstructor;
|
||||
struct UnaryOperatorExpression;
|
||||
using Expression = std::variant<
|
||||
std::unique_ptr<LambdaFunction>,
|
||||
std::unique_ptr<TypeConstructor>,
|
||||
std::unique_ptr<PrefixedExpression>,
|
||||
std::unique_ptr<UnaryOperatorExpression>,
|
||||
std::unique_ptr<SubExpression>>;
|
||||
//
|
||||
struct TupleExpression;
|
||||
|
|
@ -174,7 +172,6 @@ struct ScopedStatement;
|
|||
// Operators
|
||||
|
||||
struct BinaryOperatorExpression;
|
||||
struct UnaryOperatorExpression;
|
||||
struct ReferenceExpression;
|
||||
|
||||
// Other expressions
|
||||
|
|
@ -246,14 +243,8 @@ struct ParametrizedType;
|
|||
// Comments [IGNORE] -----------------
|
||||
// Identifiers, constants, etc. -----------------
|
||||
|
||||
struct ExtendedName {
|
||||
BaseNode base;
|
||||
|
||||
std::string name;
|
||||
};
|
||||
|
||||
using Pattern = std::variant<
|
||||
std::unique_ptr<ExtendedName>,
|
||||
std::unique_ptr<NameIdentifier>,
|
||||
std::unique_ptr<Literal>,
|
||||
std::unique_ptr<TypeConstructorPattern>>;
|
||||
|
||||
|
|
@ -323,7 +314,7 @@ struct FunctionDeclaration {
|
|||
BaseNode base;
|
||||
|
||||
bool is_in_interface = false;
|
||||
ExtendedName name;
|
||||
NameOrOperatorIdentifier name;
|
||||
std::vector<std::unique_ptr<AnnotatedAbstractType>> parameters;
|
||||
std::unique_ptr<FunctionType> type;
|
||||
|
||||
|
|
@ -384,9 +375,8 @@ struct PartitionStatement {
|
|||
struct FunctionDefinition {
|
||||
BaseNode base;
|
||||
|
||||
utils::FunctionTypeModifier modifier;
|
||||
ExtendedName name;
|
||||
std::vector<ExtendedName> arguments;
|
||||
NameOrOperatorIdentifier name;
|
||||
std::vector<NameIdentifier> arguments;
|
||||
};
|
||||
|
||||
struct TypeDefinition {
|
||||
|
|
@ -408,7 +398,7 @@ struct AnyAnnotatedType {
|
|||
struct TypeConstructorPatternParameter {
|
||||
BaseNode base;
|
||||
|
||||
std::optional<ExtendedName> name;
|
||||
std::optional<NameIdentifier> name;
|
||||
ScopedPattern value;
|
||||
};
|
||||
|
||||
|
|
@ -498,20 +488,12 @@ struct BinaryOperatorExpression {
|
|||
OperatorIdentifier operator_name;
|
||||
SubExpression left_expression;
|
||||
SubExpression right_expression;
|
||||
size_t precedence = utils::MaxOperatorPrecedence;
|
||||
|
||||
utils::IdType function_id_;
|
||||
bool is_method_ = false;
|
||||
};
|
||||
|
||||
struct UnaryOperatorExpression {
|
||||
BaseNode base;
|
||||
|
||||
OperatorIdentifier operator_name;
|
||||
Expression expression;
|
||||
|
||||
utils::IdType function_id_;
|
||||
};
|
||||
|
||||
struct ReferenceExpression {
|
||||
BaseNode base;
|
||||
|
||||
|
|
@ -533,7 +515,7 @@ struct FunctionCallExpression {
|
|||
|
||||
std::optional<std::variant<std::unique_ptr<SubExpressionToken>,
|
||||
std::unique_ptr<TypeExpression>>> prefix;
|
||||
ExtendedName name;
|
||||
NameOrOperatorIdentifier name;
|
||||
std::vector<std::unique_ptr<TypeExpression>> parameters;
|
||||
std::vector<SubExpressionToken> arguments;
|
||||
|
||||
|
|
@ -561,7 +543,7 @@ struct ReturnExpression {
|
|||
struct TypeConstructorParameter {
|
||||
BaseNode base;
|
||||
|
||||
std::optional<ExtendedName> name;
|
||||
std::optional<NameIdentifier> name;
|
||||
std::optional<utils::AssignmentModifier> asignment_modifier;
|
||||
SubExpression value;
|
||||
};
|
||||
|
|
@ -577,7 +559,7 @@ struct LambdaFunction {
|
|||
BaseNode base;
|
||||
|
||||
std::vector<std::unique_ptr<AnnotatedAbstractType>> parameters;
|
||||
std::vector<ExtendedName> arguments;
|
||||
std::vector<NameIdentifier> arguments;
|
||||
Expression expression;
|
||||
|
||||
std::vector<utils::IdType> argument_graph_ids_;
|
||||
|
|
@ -595,7 +577,7 @@ struct ArrayExpression {
|
|||
struct NameExpression {
|
||||
BaseNode base;
|
||||
|
||||
std::vector<ExtendedName> names;
|
||||
std::vector<NameIdentifier> names;
|
||||
};
|
||||
|
||||
struct TupleName {
|
||||
|
|
@ -631,7 +613,7 @@ struct TupleType {
|
|||
BaseNode base;
|
||||
|
||||
std::optional<Constructor> type;
|
||||
std::vector<std::pair<std::optional<ExtendedName>, std::unique_ptr<ExtendedScopedAnyType>>> entities;
|
||||
std::vector<std::pair<std::optional<NameIdentifier>, std::unique_ptr<ExtendedScopedAnyType>>> entities;
|
||||
};
|
||||
|
||||
struct VariantType {
|
||||
|
|
|
|||
|
|
@ -62,7 +62,6 @@ private:
|
|||
// Operators
|
||||
|
||||
// // void Visit(BinaryOperatorExpression* node) override;
|
||||
// // void Visit(UnaryOperatorExpression* node) override;
|
||||
// // void Visit(ReferenceExpression* node) override;
|
||||
// // void Visit(AccessExpression* node) override;
|
||||
|
||||
|
|
@ -109,8 +108,6 @@ private:
|
|||
|
||||
// Identifiers, constants, etc. -----------------
|
||||
|
||||
// // void Visit(ExtendedName* node) override;
|
||||
|
||||
// // void Visit(std::string* node) override; // std::string
|
||||
|
||||
// // void Visit(FloatNumberLiteral* node) override;
|
||||
|
|
|
|||
|
|
@ -64,7 +64,6 @@ const std::string ScopedStatement = "scoped_statement";
|
|||
// Operators
|
||||
|
||||
const std::string BinaryOperatorExpression = "binary_operator_expression";
|
||||
const std::string UnaryOperatorExpression = "unary_operator_expression";
|
||||
const std::string ReferenceExpression = "reference_expression";
|
||||
const std::string AccessExpression = "access_expression";
|
||||
|
||||
|
|
@ -115,7 +114,6 @@ const std::string ParametrizedType = "parametrized_type";
|
|||
|
||||
// Identifiers, constants, etc. -----------------
|
||||
|
||||
const std::string ExtendedName = "extended_name";
|
||||
const std::string TypeclassIdentifier = "typeclass_identifier";
|
||||
const std::string NameIdentifier = "name_identifier";
|
||||
const std::string TypeIdentifier = "type_identifier";
|
||||
|
|
|
|||
|
|
@ -62,7 +62,6 @@ private:
|
|||
// Operators
|
||||
|
||||
void Visit(BinaryOperatorExpression* node) override;
|
||||
void Visit(UnaryOperatorExpression* node) override;
|
||||
void Visit(ReferenceExpression* node) override;
|
||||
void Visit(AccessExpression* node) override;
|
||||
|
||||
|
|
@ -109,8 +108,6 @@ private:
|
|||
|
||||
// Identifiers, constants, etc. -----------------
|
||||
|
||||
void Visit(ExtendedName* node) override;
|
||||
|
||||
void Visit(std::string* node) override; // std::string
|
||||
|
||||
void Visit(FloatNumberLiteral* node) override;
|
||||
|
|
|
|||
|
|
@ -67,7 +67,6 @@ private:
|
|||
// Operators
|
||||
|
||||
void Visit(BinaryOperatorExpression* node) override;
|
||||
void Visit(UnaryOperatorExpression* node) override;
|
||||
void Visit(ReferenceExpression* node) override;
|
||||
void Visit(AccessExpression* node) override;
|
||||
|
||||
|
|
@ -114,8 +113,6 @@ private:
|
|||
|
||||
// Identifiers, constants, etc. -----------------
|
||||
|
||||
// // void Visit(ExtendedName* node) override;
|
||||
|
||||
// // void Visit(std::string* node) override; // std::string
|
||||
|
||||
void Visit(FloatNumberLiteral* node) override;
|
||||
|
|
|
|||
|
|
@ -64,7 +64,6 @@ private:
|
|||
// Operators
|
||||
|
||||
void Visit(BinaryOperatorExpression* node) override;
|
||||
void Visit(UnaryOperatorExpression* node) override;
|
||||
void Visit(ReferenceExpression* node) override;
|
||||
void Visit(AccessExpression* node) override;
|
||||
|
||||
|
|
@ -111,8 +110,6 @@ private:
|
|||
|
||||
// Identifiers, constants, etc. -----------------
|
||||
|
||||
void Visit(ExtendedName* node) override;
|
||||
|
||||
void Visit(std::string* node) override; // std::string
|
||||
|
||||
void Visit(FloatNumberLiteral* node) override;
|
||||
|
|
|
|||
|
|
@ -14,14 +14,14 @@ using std::size_t;
|
|||
using IdType = size_t;
|
||||
|
||||
const std::string ClassInternalVarName = "self";
|
||||
const size_t MaxOperatorPrecedence = 4;
|
||||
|
||||
enum class ReferenceModifier { Reference = 0, UniqueReference = 1 };
|
||||
enum class ReferenceModifier { Reference = 0, UniqueReference = 1, Dereference = 2 };
|
||||
enum class IsConstModifier { Const = 0, Var = 1 };
|
||||
enum class ClassModifier { Struct = 0, Class = 1 };
|
||||
enum class AssignmentModifier { Assign = 0, Move = 1 };
|
||||
enum class AliasModifier { Alias = 0, Type = 1, Let = 2 };
|
||||
enum class AbstractTypeModifier { Basic = 0, Abstract = 1 };
|
||||
enum class FunctionTypeModifier { Function = 0, Operator = 1 };
|
||||
enum class PartitionModifier { Exec = 0, Test = 1 };
|
||||
|
||||
enum class ValueType { Const = 0, Var = 1, Tmp = 2 };
|
||||
|
|
|
|||
|
|
@ -76,7 +76,6 @@ protected:
|
|||
// Operators
|
||||
|
||||
virtual void Visit(BinaryOperatorExpression* node);
|
||||
virtual void Visit(UnaryOperatorExpression* node);
|
||||
virtual void Visit(ReferenceExpression* node);
|
||||
virtual void Visit(AccessExpression* node);
|
||||
|
||||
|
|
@ -127,8 +126,6 @@ protected:
|
|||
|
||||
// Identifiers, constants, etc. -----------------
|
||||
|
||||
virtual void Visit(ExtendedName* node);
|
||||
|
||||
virtual void Visit(AnyIdentifier* node); // std::string
|
||||
|
||||
virtual void Visit(FloatNumberLiteral* node);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue