Class: KipperOptimiser
compiler.KipperOptimiser
The Optimiser class for optimising Kipper code and removing dead code.
This class takes in an abstract syntax tree that was semantically analysed and outputs a new optimised abstract syntax tree that can be translated into a target language.
Since
0.8.0
Table of contents
Constructors
Properties
Methods
Constructors
constructor
• new KipperOptimiser(programCtx
)
Parameters
Name | Type |
---|---|
programCtx |
KipperProgramContext |
Defined in
kipper/core/src/compiler/optimiser/optimiser.ts:52
Properties
programCtx
• Readonly
programCtx: KipperProgramContext
Defined in
kipper/core/src/compiler/optimiser/optimiser.ts:50
Methods
optimise
▸ optimise(astTree
, options?
): Promise
<RootASTNode
>
Optimises the astTree and programCtx based on the options argument.
This function takes in an abstract syntax tree that was semantically analysed and outputs a new optimised abstract syntax tree that can be translated into a target language.
Since
0.8.0
Parameters
Name | Type | Default value |
---|---|---|
astTree |
RootASTNode |
undefined |
options |
OptimisationOptions |
defaultOptimisationOptions |
Returns
Defined in
kipper/core/src/compiler/optimiser/optimiser.ts:65
optimiseBuiltIns
▸ Private
optimiseBuiltIns(): Promise
<void
>
Optimises the built-in functions of Kipper by removing any unneeded built-in definition.
Since
0.8.0
Returns
Promise
<void
>
Defined in
kipper/core/src/compiler/optimiser/optimiser.ts:84
optimiseInternals
▸ Private
optimiseInternals(): Promise
<void
>
Optimises the internal functions of Kipper by removing any unneeded internal definition.
Since
0.8.0
Returns
Promise
<void
>
Defined in
kipper/core/src/compiler/optimiser/optimiser.ts:114