• 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: KipperTargetBuiltInGenerator

    compiler.KipperTargetBuiltInGenerator

    Generator for the Kipper built-ins that are specific for a target.

    This class must be specified when using a KipperCompileTarget and is used to generate the required built-in functions that can be called during runtime in the target language.

    The functions in this class are automatically called by generateRequirements when used inside a KipperProgramContext, so there is no need to call it yourself.

    Since

    0.10.0

    Table of contents

    Constructors

    • constructor

    Methods

    • NaN
    • __name__
    • boolToNum
    • boolToStr
    • forceCastAs
    • index
    • len
    • nullToStr
    • numToStr
    • print
    • repeatString
    • slice
    • strToNum
    • tryCastAs
    • undefinedToStr
    • voidToStr

    Constructors

    constructor

    • new KipperTargetBuiltInGenerator()

    Methods

    NaN

    ▸ Abstract NaN(varSpec, programCtx): Promise<TranslatedCodeLine[]>

    Built-in variable 'NaN' that provides the NaN value.

    Since

    0.12.0

    Parameters

    Name Type Description
    varSpec BuiltInVariable The specification for the variable. This contains the overall metadata for the variable that should be followed. This is auto-inserted by the code-generator in KipperProgramContext.
    programCtx KipperProgramContext The program context of the environment that is being compiled.

    Returns

    Promise<TranslatedCodeLine[]>

    Defined in

    kipper/core/src/compiler/target-presets/translation/built-ins-generator.ts:181


    __name__

    ▸ Abstract name(varSpec, programCtx): Promise<TranslatedCodeLine[]>

    Built-in variable 'name' that provides the name of the current file being run.

    Since

    0.10.0

    Parameters

    Name Type Description
    varSpec BuiltInVariable The specification for the variable. This contains the overall metadata for the variable that should be followed. This is auto-inserted by the code-generator in KipperProgramContext.
    programCtx KipperProgramContext The program context of the environment that is being compiled.

    Returns

    Promise<TranslatedCodeLine[]>

    Defined in

    kipper/core/src/compiler/target-presets/translation/built-ins-generator.ts:172


    boolToNum

    ▸ Abstract boolToNum(func, programCtx): Promise<TranslatedCodeLine[]>

    Conversion function which provides 'bool' to 'num' type conversion functionality.

    Since

    0.10.0

    Parameters

    Name Type Description
    func InternalFunction The specification for the function. This contains the overall metadata for the function that should be followed. This is auto-inserted by the code-generator in KipperProgramContext.
    programCtx KipperProgramContext The program context of the environment that is being compiled.

    Returns

    Promise<TranslatedCodeLine[]>

    Defined in

    kipper/core/src/compiler/target-presets/translation/built-ins-generator.ts:85


    boolToStr

    ▸ Abstract boolToStr(func, programCtx): Promise<TranslatedCodeLine[]>

    Conversion function which provides 'bool' to 'str' type conversion functionality.

    Since

    0.10.0

    Parameters

    Name Type Description
    func InternalFunction The specification for the function. This contains the overall metadata for the function that should be followed. This is auto-inserted by the code-generator in KipperProgramContext.
    programCtx KipperProgramContext The program context of the environment that is being compiled.

    Returns

    Promise<TranslatedCodeLine[]>

    Defined in

    kipper/core/src/compiler/target-presets/translation/built-ins-generator.ts:40


    forceCastAs

    ▸ Abstract forceCastAs(funcSpec, programCtx): Promise<TranslatedCodeLine[]>

    Force-cast function which provides the ability to force-cast a value to a specific type. If the value cannot be cast to the type, then an error is thrown.

    Since

    0.12.0

    Parameters

    Name Type Description
    funcSpec InternalFunction The specification for the function. This contains the overall metadata for the function that
    programCtx KipperProgramContext The program context of the environment that is being compiled.

    Returns

    Promise<TranslatedCodeLine[]>

    Defined in

    kipper/core/src/compiler/target-presets/translation/built-ins-generator.ts:138


    index

    ▸ Abstract index(funcSpec, programCtx): Promise<TranslatedCodeLine[]>

    Index function which provides the ability to index an iterable object-like type.

    This is used to get a specific index from an iterable object-like type, such as a string or array. Though unlike in JavaScript this will assert that the index is within the bounds of the iterable object-like type. Otherwise, an error will be thrown.

    Parameters

    Name Type Description
    funcSpec InternalFunction The specification for the function. This contains the overall metadata for the function that should be followed. This is auto-inserted by the code-generator in KipperProgramContext.
    programCtx KipperProgramContext The program context of the environment that is being compiled.

    Returns

    Promise<TranslatedCodeLine[]>

    Defined in

    kipper/core/src/compiler/target-presets/translation/built-ins-generator.ts:108


    len

    ▸ Abstract len(funcSpec, programCtx): Promise<TranslatedCodeLine[]>

    Len function which provides the ability to get the length of an iterable array-like type.

    Since

    0.10.0

    Parameters

    Name Type Description
    funcSpec BuiltInFunction The specification for the function. This contains the overall metadata for the function that should be followed. This is auto-inserted by the code-generator in KipperProgramContext.
    programCtx KipperProgramContext The program context of the environment that is being compiled.

    Returns

    Promise<TranslatedCodeLine[]>

    Defined in

    kipper/core/src/compiler/target-presets/translation/built-ins-generator.ts:163


    nullToStr

    ▸ Abstract nullToStr(func, programCtx): Promise<TranslatedCodeLine[]>

    Conversion function which provides 'null' to 'str' type conversion functionality.

    Since

    0.11.0

    Parameters

    Name Type Description
    func InternalFunction The specification for the function. This contains the overall metadata for the function that should be followed. This is auto-inserted by the code-generator in KipperProgramContext.
    programCtx KipperProgramContext The program context of the environment that is being compiled.

    Returns

    Promise<TranslatedCodeLine[]>

    Defined in

    kipper/core/src/compiler/target-presets/translation/built-ins-generator.ts:58


    numToStr

    ▸ Abstract numToStr(func, programCtx): Promise<TranslatedCodeLine[]>

    Conversion function which provides 'num' to 'str' type conversion functionality.

    Since

    0.10.0

    Parameters

    Name Type Description
    func InternalFunction The specification for the function. This contains the overall metadata for the function that should be followed. This is auto-inserted by the code-generator in KipperProgramContext.
    programCtx KipperProgramContext The program context of the environment that is being compiled.

    Returns

    Promise<TranslatedCodeLine[]>

    Defined in

    kipper/core/src/compiler/target-presets/translation/built-ins-generator.ts:31


    print

    ▸ Abstract print(funcSpec, programCtx): Promise<TranslatedCodeLine[]>

    Print function which provides default IO console output functionality.

    Since

    0.10.0

    Parameters

    Name Type Description
    funcSpec BuiltInFunction The specification for the function. This contains the overall metadata for the function that should be followed. This is auto-inserted by the code-generator in KipperProgramContext.
    programCtx KipperProgramContext The program context of the environment that is being compiled.

    Returns

    Promise<TranslatedCodeLine[]>

    Defined in

    kipper/core/src/compiler/target-presets/translation/built-ins-generator.ts:154


    repeatString

    ▸ Abstract repeatString(funcSpec, programCtx): Promise<TranslatedCodeLine[]>

    Repeat string function which provides the ability to repeat a string a given number of times.

    Since

    0.10.0

    Parameters

    Name Type Description
    funcSpec InternalFunction The specification for the function. This contains the overall metadata for the function that should be followed. This is auto-inserted by the code-generator in KipperProgramContext.
    programCtx KipperProgramContext The program context of the environment that is being compiled.

    Returns

    Promise<TranslatedCodeLine[]>

    Defined in

    kipper/core/src/compiler/target-presets/translation/built-ins-generator.ts:117


    slice

    ▸ Abstract slice(funcSpec, programCtx): Promise<TranslatedCodeLine[]>

    Slice function which provides the ability to slice an iterable object-like type.

    This function is used to slice types, such as a string or array, into a new object-like or primitive type. This is used to get a substring from a string, or a sub-array from an array.

    Parameters

    Name Type Description
    funcSpec InternalFunction The specification for the function. This contains the overall metadata for the function that should be followed. This is auto-inserted by the code-generator in KipperProgramContext.
    programCtx KipperProgramContext The program context of the environment that is being compiled.

    Returns

    Promise<TranslatedCodeLine[]>

    Defined in

    kipper/core/src/compiler/target-presets/translation/built-ins-generator.ts:96


    strToNum

    ▸ Abstract strToNum(func, programCtx): Promise<TranslatedCodeLine[]>

    Conversion function which provides 'str' to 'num' type conversion functionality.

    Since

    0.10.0

    Parameters

    Name Type Description
    func InternalFunction The specification for the function. This contains the overall metadata for the function that should be followed. This is auto-inserted by the code-generator in KipperProgramContext.
    programCtx KipperProgramContext The program context of the environment that is being compiled.

    Returns

    Promise<TranslatedCodeLine[]>

    Defined in

    kipper/core/src/compiler/target-presets/translation/built-ins-generator.ts:76


    tryCastAs

    ▸ Abstract tryCastAs(funcSpec, programCtx): Promise<TranslatedCodeLine[]>

    Try-cast function which provides the ability to try-cast a value to a specific type. If the value cannot be cast to the type, then null is returned.

    Since

    0.12.0

    Parameters

    Name Type Description
    funcSpec InternalFunction The specification for the function. This contains the overall metadata for the function that
    programCtx KipperProgramContext The program context of the environment that is being compiled.

    Returns

    Promise<TranslatedCodeLine[]>

    Defined in

    kipper/core/src/compiler/target-presets/translation/built-ins-generator.ts:129


    undefinedToStr

    ▸ Abstract undefinedToStr(func, programCtx): Promise<TranslatedCodeLine[]>

    Conversion function which provides 'undefined' to 'str' type conversion functionality.

    Since

    0.11.0

    Parameters

    Name Type Description
    func InternalFunction The specification for the function. This contains the overall metadata for the function that should be followed. This is auto-inserted by the code-generator in KipperProgramContext.
    programCtx KipperProgramContext The program context of the environment that is being compiled.

    Returns

    Promise<TranslatedCodeLine[]>

    Defined in

    kipper/core/src/compiler/target-presets/translation/built-ins-generator.ts:67


    voidToStr

    ▸ Abstract voidToStr(func, programCtx): Promise<TranslatedCodeLine[]>

    Conversion function which provides 'str' to 'str' type conversion functionality.

    Since

    0.11.0

    Parameters

    Name Type Description
    func InternalFunction The specification for the function. This contains the overall metadata for the function that should be followed. This is auto-inserted by the code-generator in KipperProgramContext.
    programCtx KipperProgramContext The program context of the environment that is being compiled.

    Returns

    Promise<TranslatedCodeLine[]>

    Defined in

    kipper/core/src/compiler/target-presets/translation/built-ins-generator.ts:49

  • 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.