diff --git a/src/compiler/Nub.Lang/Backend/Generator.cs b/src/compiler/Nub.Lang/Backend/Generator.cs index 5c053ea..7351a95 100644 --- a/src/compiler/Nub.Lang/Backend/Generator.cs +++ b/src/compiler/Nub.Lang/Backend/Generator.cs @@ -1,6 +1,7 @@ using System.Globalization; using System.Text; using Nub.Lang.Frontend.Parsing; +using Nub.Lang.Frontend.Typing; namespace Nub.Lang.Backend; diff --git a/src/compiler/Nub.Lang/Frontend/DiagnosticsResult.cs b/src/compiler/Nub.Lang/Frontend/Diagnostics/DiagnosticsResult.cs similarity index 87% rename from src/compiler/Nub.Lang/Frontend/DiagnosticsResult.cs rename to src/compiler/Nub.Lang/Frontend/Diagnostics/DiagnosticsResult.cs index 8805626..18f93f5 100644 --- a/src/compiler/Nub.Lang/Frontend/DiagnosticsResult.cs +++ b/src/compiler/Nub.Lang/Frontend/Diagnostics/DiagnosticsResult.cs @@ -1,6 +1,4 @@ -using Nub.Lang.Frontend.Diagnostics; - -namespace Nub.Lang.Frontend; +namespace Nub.Lang.Frontend.Diagnostics; public class DiagnosticsResult(List diagnostics) { diff --git a/src/compiler/Nub.Lang/Frontend/Lexing/Lexer.cs b/src/compiler/Nub.Lang/Frontend/Lexing/Lexer.cs index 2e24ec3..95ad60b 100644 --- a/src/compiler/Nub.Lang/Frontend/Lexing/Lexer.cs +++ b/src/compiler/Nub.Lang/Frontend/Lexing/Lexer.cs @@ -1,4 +1,5 @@ using Nub.Lang.Frontend.Diagnostics; +using Nub.Lang.Frontend.Typing; namespace Nub.Lang.Frontend.Lexing; diff --git a/src/compiler/Nub.Lang/Frontend/Lexing/LiteralToken.cs b/src/compiler/Nub.Lang/Frontend/Lexing/LiteralToken.cs index 07cad59..8d45d84 100644 --- a/src/compiler/Nub.Lang/Frontend/Lexing/LiteralToken.cs +++ b/src/compiler/Nub.Lang/Frontend/Lexing/LiteralToken.cs @@ -1,4 +1,5 @@ using Nub.Lang.Frontend.Diagnostics; +using Nub.Lang.Frontend.Typing; namespace Nub.Lang.Frontend.Lexing; diff --git a/src/compiler/Nub.Lang/Frontend/Parsing/CastNode.cs b/src/compiler/Nub.Lang/Frontend/Parsing/CastNode.cs index 03117ae..7e392c2 100644 --- a/src/compiler/Nub.Lang/Frontend/Parsing/CastNode.cs +++ b/src/compiler/Nub.Lang/Frontend/Parsing/CastNode.cs @@ -1,4 +1,5 @@ using Nub.Lang.Frontend.Lexing; +using Nub.Lang.Frontend.Typing; namespace Nub.Lang.Frontend.Parsing; diff --git a/src/compiler/Nub.Lang/Frontend/Parsing/ExpressionNode.cs b/src/compiler/Nub.Lang/Frontend/Parsing/ExpressionNode.cs index b495684..5fd1bbd 100644 --- a/src/compiler/Nub.Lang/Frontend/Parsing/ExpressionNode.cs +++ b/src/compiler/Nub.Lang/Frontend/Parsing/ExpressionNode.cs @@ -1,4 +1,5 @@ using Nub.Lang.Frontend.Lexing; +using Nub.Lang.Frontend.Typing; namespace Nub.Lang.Frontend.Parsing; diff --git a/src/compiler/Nub.Lang/Frontend/Parsing/FuncDefinitionNode.cs b/src/compiler/Nub.Lang/Frontend/Parsing/FuncDefinitionNode.cs index 3cf9977..de24b0c 100644 --- a/src/compiler/Nub.Lang/Frontend/Parsing/FuncDefinitionNode.cs +++ b/src/compiler/Nub.Lang/Frontend/Parsing/FuncDefinitionNode.cs @@ -1,7 +1,17 @@ using Nub.Lang.Frontend.Lexing; +using Nub.Lang.Frontend.Typing; namespace Nub.Lang.Frontend.Parsing; +public class FuncParameter(string name, NubType type, bool variadic) +{ + public string Name { get; } = name; + public NubType Type { get; } = type; + public bool Variadic { get; } = variadic; + + public override string ToString() => $"{Name}: {Type}"; +} + public interface IFuncSignature { public string Name { get; } diff --git a/src/compiler/Nub.Lang/Frontend/Parsing/LiteralNode.cs b/src/compiler/Nub.Lang/Frontend/Parsing/LiteralNode.cs index a7a7d97..bc3e817 100644 --- a/src/compiler/Nub.Lang/Frontend/Parsing/LiteralNode.cs +++ b/src/compiler/Nub.Lang/Frontend/Parsing/LiteralNode.cs @@ -1,4 +1,5 @@ using Nub.Lang.Frontend.Lexing; +using Nub.Lang.Frontend.Typing; namespace Nub.Lang.Frontend.Parsing; diff --git a/src/compiler/Nub.Lang/Frontend/Parsing/Parser.cs b/src/compiler/Nub.Lang/Frontend/Parsing/Parser.cs index 112fef6..d2ded08 100644 --- a/src/compiler/Nub.Lang/Frontend/Parsing/Parser.cs +++ b/src/compiler/Nub.Lang/Frontend/Parsing/Parser.cs @@ -1,6 +1,7 @@ using System.Diagnostics.CodeAnalysis; using Nub.Lang.Frontend.Diagnostics; using Nub.Lang.Frontend.Lexing; +using Nub.Lang.Frontend.Typing; namespace Nub.Lang.Frontend.Parsing; diff --git a/src/compiler/Nub.Lang/Frontend/Parsing/StructDefinitionNode.cs b/src/compiler/Nub.Lang/Frontend/Parsing/StructDefinitionNode.cs index 9f9da96..a73aeb0 100644 --- a/src/compiler/Nub.Lang/Frontend/Parsing/StructDefinitionNode.cs +++ b/src/compiler/Nub.Lang/Frontend/Parsing/StructDefinitionNode.cs @@ -1,7 +1,15 @@ using Nub.Lang.Frontend.Lexing; +using Nub.Lang.Frontend.Typing; namespace Nub.Lang.Frontend.Parsing; +public class StructField(string name, NubType type, Optional value) +{ + public string Name { get; } = name; + public NubType Type { get; } = type; + public Optional Value { get; } = value; +} + public class StructDefinitionNode(IReadOnlyList tokens, Optional documentation, string name, List fields) : DefinitionNode(tokens, documentation) { public string Name { get; } = name; diff --git a/src/compiler/Nub.Lang/Frontend/Parsing/StructInitializerNode.cs b/src/compiler/Nub.Lang/Frontend/Parsing/StructInitializerNode.cs index 894b641..12db5e5 100644 --- a/src/compiler/Nub.Lang/Frontend/Parsing/StructInitializerNode.cs +++ b/src/compiler/Nub.Lang/Frontend/Parsing/StructInitializerNode.cs @@ -1,4 +1,5 @@ using Nub.Lang.Frontend.Lexing; +using Nub.Lang.Frontend.Typing; namespace Nub.Lang.Frontend.Parsing; diff --git a/src/compiler/Nub.Lang/Frontend/Parsing/VariableAssignmentNode.cs b/src/compiler/Nub.Lang/Frontend/Parsing/VariableAssignmentNode.cs index 575f71c..a9daa16 100644 --- a/src/compiler/Nub.Lang/Frontend/Parsing/VariableAssignmentNode.cs +++ b/src/compiler/Nub.Lang/Frontend/Parsing/VariableAssignmentNode.cs @@ -1,4 +1,5 @@ using Nub.Lang.Frontend.Lexing; +using Nub.Lang.Frontend.Typing; namespace Nub.Lang.Frontend.Parsing; diff --git a/src/compiler/Nub.Lang/NubType.cs b/src/compiler/Nub.Lang/Frontend/Typing/NubType.cs similarity index 99% rename from src/compiler/Nub.Lang/NubType.cs rename to src/compiler/Nub.Lang/Frontend/Typing/NubType.cs index 0d58dd4..b65bf7a 100644 --- a/src/compiler/Nub.Lang/NubType.cs +++ b/src/compiler/Nub.Lang/Frontend/Typing/NubType.cs @@ -1,6 +1,6 @@ using System.Diagnostics.CodeAnalysis; -namespace Nub.Lang; +namespace Nub.Lang.Frontend.Typing; public abstract class NubType { diff --git a/src/compiler/Nub.Lang/FuncParameter.cs b/src/compiler/Nub.Lang/FuncParameter.cs deleted file mode 100644 index 6f19992..0000000 --- a/src/compiler/Nub.Lang/FuncParameter.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Nub.Lang; - -public class FuncParameter(string name, NubType type, bool variadic) -{ - public string Name { get; } = name; - public NubType Type { get; } = type; - public bool Variadic { get; } = variadic; - - public override string ToString() => $"{Name}: {Type}"; -} \ No newline at end of file diff --git a/src/compiler/Nub.Lang/StructField.cs b/src/compiler/Nub.Lang/StructField.cs deleted file mode 100644 index 56d9946..0000000 --- a/src/compiler/Nub.Lang/StructField.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Nub.Lang.Frontend.Parsing; - -namespace Nub.Lang; - -public class StructField(string name, NubType type, Optional value) -{ - public string Name { get; } = name; - public NubType Type { get; } = type; - public Optional Value { get; } = value; -} \ No newline at end of file