//============================================================================// // // // 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 . // // // //============================================================================// #pragma once #include #include #include namespace arti::lang::ast { namespace nodes { /* Forward declaration of types */ /* Main declaration node types */ struct ModuleDeclaration; struct StructDeclaration; struct EnumDeclaration; struct FunctionDeclaration; struct ImportDeclaration; struct AliasDeclaration; /* Helper declaration node types */ struct EnumMember; struct StructMember; struct GenericParam; struct FunctionParam; } // namespace nodes /* Public Aliases */ using ModuleDeclNode = Ptr; using StructDeclNode = Ptr; using EnumDeclNode = Ptr; using FunctionDeclNode = Ptr; using ImportDeclNode = Ptr; using AliasDeclNode = Ptr; using GenericParamNode = Ptr; using FunctionParamNode = Ptr; using EnumMemberNode = Ptr; using StructMemberNode = Ptr; /* Variant nodes */ using TopLevelDeclNode = Variant< ModuleDeclNode, StructDeclNode, EnumDeclNode, FunctionDeclNode, ImportDeclNode, AliasDeclNode >; using ModuleInnerDeclNode = Variant< StructDeclNode, EnumDeclNode, FunctionDeclNode >; /* Node definitions */ struct nodes::ModuleDeclaration { SourceLocation location; Boolean isExported; NamespacedIdentifierNode name; Vector childModules; Vector innerDeclarations; Vector aliasDeclarations; }; struct nodes::StructDeclaration { SourceLocation location; Boolean isExported; String name; Vector genericParams; Vector structMembers; }; struct nodes::EnumDeclaration { SourceLocation location; Boolean isExported; String name; Vector genericParams; Vector enumMembers; }; struct nodes::FunctionDeclaration { SourceLocation location; Boolean isExported; String name; Optional returnType; Vector genericParams; Vector functionParams; CodeBlockStmtNode functionBody; }; struct nodes::ImportDeclaration { SourceLocation location; Boolean importAll; NamespacedIdentifierNode importTarget; }; struct nodes::AliasDeclaration { SourceLocation location; String alias; TypeNode target; }; struct nodes::StructMember { SourceLocation location; String name; TypeNode type; }; struct nodes::EnumMember { SourceLocation location; String name; Optional type; }; struct nodes::GenericParam { SourceLocation location; String name; }; struct nodes::FunctionParam { SourceLocation location; Boolean isThis; String name; TypeNode type; }; } // namespace arti::lang::ast