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
Methods
- __name__
- boolToNum
- boolToStr
- index
- len
- nullToStr
- numToStr
- repeatString
- slice
- strToNum
- undefinedToStr
- voidToStr
Constructors
constructor
• new KipperTargetBuiltInGenerator()
Methods
__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
Defined in
kipper/core/src/compiler/target-presets/translation/built-ins-generator.ts:144
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
Defined in
kipper/core/src/compiler/target-presets/translation/built-ins-generator.ts:82
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
Defined in
kipper/core/src/compiler/target-presets/translation/built-ins-generator.ts:37
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
Defined in
kipper/core/src/compiler/target-presets/translation/built-ins-generator.ts:105
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
Defined in
kipper/core/src/compiler/target-presets/translation/built-ins-generator.ts:135
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
Defined in
kipper/core/src/compiler/target-presets/translation/built-ins-generator.ts:55
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
Defined in
kipper/core/src/compiler/target-presets/translation/built-ins-generator.ts:28
▸ 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
Defined in
kipper/core/src/compiler/target-presets/translation/built-ins-generator.ts:126
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
Defined in
kipper/core/src/compiler/target-presets/translation/built-ins-generator.ts:114
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
Defined in
kipper/core/src/compiler/target-presets/translation/built-ins-generator.ts:93
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
Defined in
kipper/core/src/compiler/target-presets/translation/built-ins-generator.ts:73
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
Defined in
kipper/core/src/compiler/target-presets/translation/built-ins-generator.ts:64
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
Defined in
kipper/core/src/compiler/target-presets/translation/built-ins-generator.ts:46