mirror of
https://codeberg.org/ProgramSnail/lang_2023.git
synced 2025-12-26 08:48:44 +00:00
build_visitor fixed, going to test it
This commit is contained in:
parent
5bf0c1bf48
commit
c34523bd4f
23 changed files with 45468 additions and 45273 deletions
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
// for clangd
|
||||
#include "interpreter_tree.hpp"
|
||||
#include "visitor.hpp"
|
||||
#include "parse_tree.hpp"
|
||||
|
||||
|
|
@ -47,6 +48,8 @@ private:
|
|||
|
||||
// Flow control -----------------
|
||||
|
||||
void Visit(TypeConstructorPatternParameter* node) override;
|
||||
void Visit(TypeConstructorPattern* node) override;
|
||||
void Visit(MatchCase* node) override;
|
||||
void Visit(Match* node) override;
|
||||
void Visit(Condition* node) override;
|
||||
|
|
@ -55,6 +58,8 @@ private:
|
|||
void Visit(ForLoop* node) override;
|
||||
void Visit(LoopLoop* node) override;
|
||||
|
||||
void Visit(PatternToken& node) override; // variant
|
||||
void Visit(Pattern& node) override; // variant
|
||||
void Visit(FlowControl& node) override; // variant
|
||||
|
||||
// Statements, expressions, blocks, etc. -----------------
|
||||
|
|
@ -87,6 +92,7 @@ private:
|
|||
void Visit(TupleExpression* node) override;
|
||||
void Visit(VariantExpression* node) override;
|
||||
void Visit(ReturnExpression* node) override;
|
||||
void Visit(TypeConstructorParameter* node) override;
|
||||
void Visit(TypeConstructor* node) override;
|
||||
void Visit(LambdaFunction* node) override;
|
||||
void Visit(ArrayExpression* node) override;
|
||||
|
|
@ -109,7 +115,6 @@ private:
|
|||
void Visit(FunctionType* node) override;
|
||||
void Visit(TupleType* node) override;
|
||||
void Visit(VariantType* node) override;
|
||||
void Visit(ParametrizedType* node) override;
|
||||
void Visit(TypeExpression* node) override;
|
||||
|
||||
void Visit(AnyType& node) override; // variant
|
||||
|
|
@ -118,14 +123,15 @@ private:
|
|||
|
||||
// Typeclass
|
||||
|
||||
void Visit(ParametrizedTypeclass* node) override;
|
||||
void Visit(TypeclassExpression* node) override;
|
||||
void Visit(ParametrizedTypeclass* node) override;
|
||||
|
||||
void Visit(TypeclassUsage& node) override; // variant
|
||||
void Visit(TypeclassSubExpression& node) override; // variant
|
||||
|
||||
// Typeclass & Type
|
||||
|
||||
void Visit(TypeParameter& node) override; // variant
|
||||
void Visit(ParametrizedType* node) override;
|
||||
|
||||
void Visit(TypeSubExpression& node) override; // variant
|
||||
|
||||
// Identifiers, constants, etc. -----------------
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
// for clangd
|
||||
#include "utils.hpp"
|
||||
#include "types_info.hpp"
|
||||
|
||||
namespace interpreter::tokens {
|
||||
|
||||
|
|
@ -69,6 +68,7 @@ using AnyAnnotatedType = AnnotatedType;
|
|||
|
||||
// Flow control -----------------
|
||||
|
||||
struct TypeConstructorPatternParameter;
|
||||
struct TypeConstructorPattern;
|
||||
|
||||
struct Match;
|
||||
|
|
@ -167,6 +167,7 @@ struct FunctionCallExpression;
|
|||
struct TupleExpression;
|
||||
struct VariantExpression;
|
||||
struct ReturnExpression;
|
||||
struct TypeConstructorParameter;
|
||||
struct TypeConstructor;
|
||||
struct LambdaFunction;
|
||||
struct ArrayExpression;
|
||||
|
|
@ -376,9 +377,14 @@ struct AnnotatedAbstractType {
|
|||
|
||||
// ----------------- Flow control -----------------
|
||||
|
||||
struct TypeConstructorPatternParameter {
|
||||
std::optional<ExtendedName> name;
|
||||
PatternToken value;
|
||||
};
|
||||
|
||||
struct TypeConstructorPattern {
|
||||
TypeIdentifier constructor;
|
||||
std::vector<std::pair<std::optional<ExtendedName>, PatternToken>> parameters;
|
||||
std::vector<TypeConstructorPatternParameter> parameters;
|
||||
};
|
||||
|
||||
struct MatchCase {
|
||||
|
|
@ -459,8 +465,8 @@ struct AccessExpression {
|
|||
// Other Expressions -----------------
|
||||
|
||||
struct FunctionCallExpression {
|
||||
std::variant<std::unique_ptr<SubExpressionToken>,
|
||||
std::unique_ptr<TypeExpression>> prefix;
|
||||
std::optional<std::variant<std::unique_ptr<SubExpressionToken>,
|
||||
std::unique_ptr<TypeExpression>>> prefix;
|
||||
ExtendedName name;
|
||||
std::vector<FunctionArgument> arguments;
|
||||
};
|
||||
|
|
@ -477,10 +483,16 @@ struct ReturnExpression {
|
|||
Expression expression;
|
||||
};
|
||||
|
||||
struct TypeConstructor {
|
||||
struct TypeConstructorParameter {
|
||||
enum AssignmentModifier { Move, Assign };
|
||||
std::optional<ExtendedName> name;
|
||||
std::optional<AssignmentModifier> asignment_modifier;
|
||||
PatternToken value;
|
||||
};
|
||||
|
||||
struct TypeConstructor {
|
||||
std::unique_ptr<TypeExpression> constructor;
|
||||
std::vector<std::pair<std::optional<std::pair<ExtendedName, AssignmentModifier>>, SubExpression>> parameters;
|
||||
std::vector<TypeConstructorParameter> parameters;
|
||||
};
|
||||
|
||||
struct LambdaFunction {
|
||||
|
|
|
|||
|
|
@ -37,6 +37,9 @@ const std::string AnnotatedType = "annotated_type";
|
|||
|
||||
// Flow control -----------------
|
||||
|
||||
const std::string TypeConstructorPattern = "type_constructor_pattern";
|
||||
const std::string PatternToken = "pattern_token";
|
||||
const std::string Pattern = "pattern";
|
||||
const std::string MatchCase = "match_case";
|
||||
const std::string Match = "match";
|
||||
const std::string Condition = "condition";
|
||||
|
|
@ -93,7 +96,6 @@ const std::string ScopedAnyName = "scoped_any_name";
|
|||
const std::string FunctionType = "function_type";
|
||||
const std::string TupleType = "tuple_type";
|
||||
const std::string VariantType = "variant_type";
|
||||
const std::string ParametrizedType = "parametrized_type";
|
||||
const std::string TypeExpression = "type_expression";
|
||||
const std::string Constructor = "constructor";
|
||||
const std::string AnyType = "any_type";
|
||||
|
|
@ -102,13 +104,16 @@ const std::string ExtendedScopedAnyType = "extended_scoped_any_type";
|
|||
|
||||
// Typeclass
|
||||
|
||||
const std::string TypeclassUsage = "typeclass_usage";
|
||||
const std::string ParametrizedTypeclass = "parametrized_typeclass";
|
||||
const std::string TypeclassExpression = "typeclass_expression";
|
||||
const std::string ParametrizedTypeclass = "parametrized_typeclass";
|
||||
|
||||
const std::string TypeclassSubExpression = "typeclass_subexpression";
|
||||
|
||||
|
||||
// Typeclass & Type
|
||||
|
||||
const std::string TypeParameter = "type_parameter";
|
||||
const std::string ParametrizedType = "parametrized_type";
|
||||
|
||||
const std::string TypeSubExpression = "type_subexpression";
|
||||
|
||||
// Identifiers, constants, etc. -----------------
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ private:
|
|||
|
||||
// Flow control -----------------
|
||||
|
||||
void Visit(TypeConstructorPatternParameter* node) override;
|
||||
void Visit(TypeConstructorPattern* node) override;
|
||||
void Visit(MatchCase* node) override;
|
||||
void Visit(Match* node) override;
|
||||
|
|
@ -70,6 +71,7 @@ private:
|
|||
void Visit(TupleExpression* node) override;
|
||||
void Visit(VariantExpression* node) override;
|
||||
void Visit(ReturnExpression* node) override;
|
||||
void Visit(TypeConstructorParameter* node) override;
|
||||
void Visit(TypeConstructor* node) override;
|
||||
void Visit(LambdaFunction* node) override;
|
||||
void Visit(ArrayExpression* node) override;
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ protected:
|
|||
|
||||
// Flow control -----------------
|
||||
|
||||
virtual void Visit(TypeConstructorPatternParameter* node);
|
||||
virtual void Visit(TypeConstructorPattern* node);
|
||||
virtual void Visit(MatchCase* node);
|
||||
virtual void Visit(Match* node);
|
||||
|
|
@ -79,7 +80,7 @@ protected:
|
|||
virtual void Visit(ReferenceExpression* node);
|
||||
virtual void Visit(AccessExpression* node);
|
||||
|
||||
// Simple Expressions
|
||||
// Other expressions
|
||||
|
||||
virtual void Visit(FunctionCallExpression* node);
|
||||
|
||||
|
|
@ -88,6 +89,7 @@ protected:
|
|||
virtual void Visit(TupleExpression* node);
|
||||
virtual void Visit(VariantExpression* node);
|
||||
virtual void Visit(ReturnExpression* node);
|
||||
virtual void Visit(TypeConstructorParameter* node);
|
||||
virtual void Visit(TypeConstructor* node);
|
||||
virtual void Visit(LambdaFunction* node);
|
||||
virtual void Visit(ArrayExpression* node);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue