• Kipper

    v0.12.1
  • Downloads

  • Docs

  • Playground

  • Changelog

  • Kipper

    v0.12.1
    • Downloads

    • Docs

    • Playground

    • Changelog

      • next /
      • Kipper API /
      • Module /
      • @kipper/core /
      • compiler
    Kipper Docs
    • next
    • latest
    • 0.11.0
    • 0.10.4
    • 0.9.2
    • Overview

    • Quickstart

    • Goals for Kipper

    • Supported platforms

    • Usage Examples

      • Overview

    • Variables

      • Overview

      • String Type

      • Number Type

      • Boolean Type

      • Void Type

      • Null Type

      • Undefined Type

      • Array Type

      • Overview

      • Tangled Expression

      • Arithmetic Expression

      • Assignment Expression

      • Conditional Expressions

      • Logical Expressions

      • Bitwise Expression

      • Relational Expressions

      • Convert Or Cast Expression

      • F-String Expression

      • Member Access Expression

      • Function Call Expression

      • Lambda Expression

      • Matches Expression

      • Overview

      • Expression Statement

      • If Statement

      • While Loop

      • Do-While Loop

      • For Loop

      • Compound Statement

      • Jump Statement

    • Functions

    • Interfaces

    • Classes

    • Comments

    • Built-in Functions

      • Overview

      • Compiler Setup

        • Overview

          • index

          • compiler

          • errors

          • logger

          • utils

          • config

          • index

          • index

        • Overview

        • new

        • run

        • compile

        • help

        • version

      • next /
      • Kipper API /
      • Module /
      • @kipper/core /
      • compiler
    • next /
    • Kipper API /
    • Module /
    • @kipper/core /
    • compiler

    Edit page

    Class: ASTNodeFactory<T, U>

    compiler.ASTNodeFactory

    A simple blueprint for a factory for creating AST nodes from a parser context.

    Since

    0.10.0

    Type parameters

    Name Type
    T extends CompilableASTNode = CompilableASTNode
    U extends KipperParserRuleContext = KipperParserRuleContext

    Hierarchy

    • ASTNodeFactory

      ↳ ExpressionASTNodeFactory

      ↳ StatementASTNodeFactory

      ↳ DeclarationASTNodeFactory

    Table of contents

    Constructors

    • constructor

    Methods

    • create
    • getRuleIds

    Constructors

    constructor

    • new ASTNodeFactory<T, U>()

    Type parameters

    Name Type
    T extends CompilableASTNode<SemanticData, TypeData, T> = CompilableASTNode<SemanticData, TypeData>
    U extends KipperParserRuleContext<U> = KipperParserRuleContext

    Methods

    create

    ▸ Abstract create(antlrRuleCtx, parent): T

    Fetches the AST node class and creates a new instance based on the antlrRuleCtx.

    Since

    0.9.0

    Parameters

    Name Type Description
    antlrRuleCtx U The context instance that the handler class should be fetched for.
    parent CompilableASTNode<SemanticData, TypeData> The parent of the AST node that is being created.

    Returns

    T

    Defined in

    kipper/core/src/compiler/ast/factories/ast-node-factory.ts:32


    getRuleIds

    ▸ Static Protected getRuleIds(ruleMapping): ConstructableASTKind[]

    Returns an array of all AST node kind ids that this factory can process.

    Since

    0.10.0

    Parameters

    Name Type
    ruleMapping Record<number, ConstructableASTNodeClass>

    Returns

    ConstructableASTKind[]

    Defined in

    kipper/core/src/compiler/ast/factories/ast-node-factory.ts:22

  • Developed at:

    • Releases
    • GitHub
    • Security
    • Issue Tracker
    • License
  • Copyright © 2021-2026 Luna Klatzer, 2024-2025 Lorenz Holzbauer & Fabian Baitura.
    Kipper is licensed under the GPL-3.0-or-later license.