- Declared in:
- LKCompiler.h
Abstract class implementing a dynamic language compiler. Concrete subclasses provide implementations for specific languages.
Adds a new class loader. These will be called in the order that they appear.
Loads a bundle containing an LKInfo.plist file. This should contain a Source key giving an array of source files in the order in which they should be compiled, a Frameworks key giving an array of frameworks and a Classes key for declaring classes being compile in other to resolve symbols correctly
Returns the compiler for files with a given extension.
Returns the compiler for a named language.
Returns the extension used for scripts in this language.
Implemented by subclasses.
Returns whether we are in developer mode. In this mode, all unrecognised symbols are assumed to be classes.
Returns the name of the language supported by this compiler.
Implemented by subclasses.
Loads all of the LanguageKit plugins for the current application.
Loads all scripts for all known languages from the application bundle.
Compiles and loads a file from the application bundle. The file name extension will be used to select a suitable compiler.
Load a framework with the specified name.
Attempts to parse a C header. Returns
YES
on success, NO
on
failure. Failure can be caused by an inability
to locate the header or by SourceCodeKit not being
available.
Loads a bundle containing an LKInfo.plist file. This should contain a Source key giving an array of source files in the order in which they should be compiled, a Frameworks key giving an array of frameworks, a Classes key for declaring classes being load in other to resolve symbols correctly and a PrincipalClass key for the class that should be instantiated when it is loaded.
Returns (Class)-1 in case of error, or the principal class if loading succeeds (Nil if no principal class is specified).
Attempts to load a library from an absolute path or one of the standard library locations.
Compiles and loads a file from the specified bundle. The file name extension will be used to select a suitable compiler.
Loads all scripts for all known languages from the specified bundle.
Parse the specified string, using the correct parse.
Returns the parser used by this language.
Reports the given error and returns
YES
if recovery should proceed.
Reports the given warning and returns
YES
if recovery should proceed.
Specifies whether the compiler should run in debug mode. Enabling this will spam stderr with a huge amount of debugging information. Note that this is a global setting and will apply to all compilers.
Sets the default delegate that will be used by new compiler instances. If this is not called then a default delegate will be installed that just logs errors and warnings to the console.
Returns the languages for which compilers are currently supported.
Compiles and loads a method on the class with the specified name.
Compiles a method to LLVM bitcode for the class with the specified name.
Compiles a method on the class with the specified name using the given code generator.
Compiles and loads the specified
source code. Returns the AST on success,
nil
on failure.
Compiles the specified source code to
LLVM bitcode. This can then be optimised with the
LLVM opt utility and converted to object code with
llc. Returns the AST on success, nil
on
failure.
Compiles the specified source code
using the given code generator. Returns the AST on
success, nil
on failure.
Loads all scripts written in this language from the application bundle.
Compiles and loads a file from the application bundle. Omit the extension in the name paramater.
Compiles and loads a file from the specified bundle. Omit the extension in the name paramater.
Loads all scripts written in this language from the specified bundle.
Sets the delegate for this compiler. The delegate is responsible for handling errors and warnings that occur during the semantic analysis of the program.
- Declared in:
- LKCompiler.h
Link LKModule into a library.
- Declared in:
- LKCompiler.h
- Conforms to:
- NSObject
Indicates that the specified compiler has encountered an unrecoverable problem. Extra information about this error may be found in the info dictionary. All errors must contain a human readable description identified by the key kLKHumanReadableDescription, specific errors may contain other information. See the LKCompilerErrors.h file for more information.
In normal circumstances, errors are unrecoverable. A
delegate may perform some manipulation on the
AST to eliminate the error, however. In this case,
the delegate should return YES
, causing
the semantic analysis to be retried.
Indicates that the specified compiler has
encountered a recoverable problem. The
delegate should return YES
if the
compiler should attempt to continue. Extra
information about this warning may be found
in the info dictionary. All warnings must
contain a human readable description identified
by the key kLKHumanReadableDesciption, specific
warnings may contain other information. See the
LKCompilerErrors.h file for more
information.
- Declared in:
- LKCompiler.h
- Conforms to:
- NSObject
All languages must use a parser conforming to this protocol.
Returns a method AST constructed by parsing the
specified source, or
nil
if parsing failed or method
parsing is not supported by this language.
Returns a module AST constructed by parsing the
specified source. The result is
nil
if parsing failed.