AvailCompiler

class AvailCompiler(moduleHeader: ModuleHeader?, module: A_Module, source: A_String, textInterface: TextInterface, pollForAbort: () -> Boolean, progressReporter: CompilerProgressReporter, problemHandler: ProblemHandler)

The compiler for Avail code.

Author

Mark van Gulik

Todd L Smith

Parameters

moduleHeader

The module header of the module to compile. May be null for synthetic modules (for entry points), or when parsing the header.

module

The current module.`

source

The source A_String.

textInterface

The text interface for any fibers started by this compiler.

pollForAbort

How to quickly check if the client wants to abort compilation.

progressReporter

How to report progress to the client who instigated compilation. This continuation that accepts the name of the module undergoing compilation, the line number on which the last complete statement concluded, the position of the ongoing parse (in bytes), and the size of the module (in bytes).

problemHandler

The ProblemHandler used for reporting compilation problems.

Constructors

Link copied to clipboard
constructor(moduleHeader: ModuleHeader?, module: A_Module, source: A_String, textInterface: TextInterface, pollForAbort: () -> Boolean, progressReporter: CompilerProgressReporter, problemHandler: ProblemHandler)

Construct a new AvailCompiler.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The CompilationContext for this compiler. It tracks parsing and lexing tasks, and handles serialization to a repository if necessary.

Link copied to clipboard

The Avail A_String containing the complete content of the module being compiled.

Functions

Link copied to clipboard
fun parseCommand(onSuccess: (List<A_Phrase>, (() -> Unit) -> Unit) -> Unit, afterFail: () -> Unit)

Parse a command, compiling it into the current module, from the token list.

Link copied to clipboard
fun parseModule(onSuccess: (A_Module) -> Unit, afterFail: () -> Unit)

Parse a module from the source and install it into the runtime. This method generally returns long before the module has been parsed, but either the onSuccess or afterFail continuation is invoked when module parsing has completed or failed.

Link copied to clipboard

Parse the header of the module from the token stream. If successful, invoke onSuccess with the ParserState just after the header, otherwise invoke onFail without reporting the problem.