Package-level declarations

Types

Link copied to clipboard

Pop an argument from the parse stack of the current potential message send. Pop a list from the parse stack. Append the argument to the list. Push the resultant list onto the parse stack.

Link copied to clipboard
abstract class ArityOneParsingOperation<T>(val commutesWithParsePart: Boolean, val canRunIfHasFirstArgument: Boolean) : ParsingOperation

ArityOneParsingOperation is a ParsingOperation that takes a single operand.

Link copied to clipboard

An AvailAcceptedParseException is thrown by primitive P_AcceptParsing to indicate the fiber running a semantic restriction has accepted the argument types and does not need to restrict the proposed expression's type.

Link copied to clipboard

An AvailCodeGenerator is used to convert a phrase into the corresponding raw function.

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

The compiler for Avail code.

Link copied to clipboard

An AvailCompilerBipartiteRendezvous comes at parsing from both sides to maximize the freedom of implementation of the parser. It uses dynamic programming to avoid parsing the same subexpression multiple times. When a new continuation needs to run against all possible subexpressions, it looks up the current parser state in a map to get the bipartite rendezvous. That contains the list of subexpressions that have been parsed so far. They are all run against the new continuation. The continuation is then added to the bipartite rendezvous's list of actions. When a new complete subexpression is found it is run against all waiting actions and added to the list of subexpressions.

Link copied to clipboard

An AvailCompilerException is thrown by the Avail compiler when compilation fails for any reason.

Link copied to clipboard

An AvailCompilerFragmentCache implements a memoization mechanism for a compiler. The purpose is to ensure that the effort to parse a subexpression starting at a specific token is reused when backtracking.

Link copied to clipboard

An AvailRejectedParseException is thrown by primitive P_RejectParsing to indicate the fiber running a semantic restriction (or macro body or prefix function) has rejected the argument types or phrases for the reason specified in the exception's constructor.

Link copied to clipboard

Branch to the specified instruction, which must be after the current instruction. Attempt to continue parsing at both the next instruction and the specified instruction.

Link copied to clipboard

Apply grammatical restrictions to the operandth leaf argument (underscore/ellipsis) of the current message, which is on the stack.

Link copied to clipboard

Check that the list phrase on the top of the stack has at least the specified size. Proceed to the next instruction only if this is the case.

Link copied to clipboard

Check that the list phrase on the top of the stack has at most the specified size. Proceed to the next instruction only if this is the case.

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

A CompilationContext lasts for a module's entire compilation activity.

Link copied to clipboard

The compiler notifies a CompilerProgressReporter whenever a top-level statement is parsed unambiguously.

The arguments are

  • the module name,

  • the module size in bytes,

  • the current parse position in bytes within the module,

  • the line number, or Int.MAX_VALUE if completed, and

  • a function that fetches the compiled top-level statement, or null if no phrase is available.

Link copied to clipboard

Concatenate the two lists that have been pushed previously.

Link copied to clipboard

Pop an argument from the parse stack and apply the conversion rule specified by operand.

Link copied to clipboard

Pop the top marker off the mark stack.

Link copied to clipboard

Push a new list that contains an empty tuple of phrases onto the parse stack.

Link copied to clipboard

Pop the top marker off the mark stack and compare it to the current parse position. If they're the same, abort the current parse, otherwise push the current parse position onto the mark stack in place of the old marker and continue parsing.

Link copied to clipboard

Throw a FiberTerminationException indicate that a fiber has suicided.

Link copied to clipboard

Check whether we are positioned immediately after a newline and whitespace. If the current indentation string is a proper extension of the initial whitespace, report a weak error and abandon this parse theory, otherwise continue parsing. In other words, permit indent that matches or decreases the initial indentation.

Link copied to clipboard

The compiler notifies a GlobalProgressReporter whenever a top-level statement is parsed unambiguously.

The arguments are:

  1. the current number of bytes that have been compiled and executed

  2. the total number of bytes of source being compiled.

Link copied to clipboard

Check whether we are positioned immediately after a newline and whitespace that contains as a prefix the whitespace on which the first token of this phrase or its leading argument occurred. If the current indentation string is a proper extension of the initial whitespace, continue parsing, otherwise report a weak error and abandon this parse theory.

Link copied to clipboard

Jump to instruction specified instruction, which must be before the current instruction. Attempt to continue parsing only at the specified instruction.

Link copied to clipboard

Jump to the specified instruction, which must be after the current instruction. Attempt to continue parsing only at the specified instruction.

Link copied to clipboard
abstract class JumpParsingOperation<Self : JumpParsingOperation<Self>>(commutesWithParsePart: Boolean, canRunIfHasFirstArgument: Boolean) : ArityOneParsingOperation<Int>

JumpParsingOperation is a ParsingOperation that performs a branch or jump.

Link copied to clipboard

Check whether we are positioned immediately after a newline and whitespace that matches the line on which the first token of this phrase or its leading argument occurred. If the indentation string (i.e., spaces and tabs) agrees, continue parsing, otherwise report a weak error and abandon this parse theory.

Link copied to clipboard
class ModuleHeader(val moduleName: ResolvedModuleName)

A module's header information.

Link copied to clipboard

Information that a ModuleHeader uses to keep track of a module import, whether from an Extends clause or a Uses clause, as specified by the SpecialMethodAtom.MODULE_HEADER.

Link copied to clipboard

A ModuleManifestEntry is a short summary of an interesting definition created by some module. This includes atoms, method definitions, semantic restrictions, lexers, module variables/constants, etc.

Link copied to clipboard

Ensure we are not positioned at a series of whitespace and comments that include a line break. This test is specifically to support "⇥⁇" and "↹⁇". Without this filter instruction, the normal token processing would allow the "didn't look for indent" path to consume any whitespace at all, including a wrong indent, making the construct pointless.

Link copied to clipboard

Parse any raw token, leaving it on the parse stack. In particular, push a literal phrase whose token is a synthetic literal token whose value is the actual token that was parsed.

Link copied to clipboard

Parse an ordinary argument of a message send, pushing the expression onto the parse stack.

Link copied to clipboard

Parse an argument of a message send, using the outermost (module) scope. Leave it on the parse stack.

Link copied to clipboard

Parse the operandth message part of the current message. This will be a specific token. It should be matched case sensitively against the source token.

Link copied to clipboard

Parse the operandth message part of the current message. This will be a specific token. It should be matched case insensitively against the source token.

Link copied to clipboard

Parse a raw keyword token, leaving it on the parse stack.

Link copied to clipboard

Parse a raw literal token, leaving it on the parse stack.

Link copied to clipboard

ParserState instances are immutable and keep track of a current lexingState and clientDataMap during parsing.

Link copied to clipboard

Parse an expression, even one whose expressionType is ⊤, then push a literal phrase wrapping this expression onto the parse stack.

Link copied to clipboard

Parse a raw token. It should correspond to a variable that is in scope. Push a variable reference onto the parse stack.

Link copied to clipboard

A ParsingConversionRule describes how to convert the argument at the top of the parsing stack from one phrase to another.

Link copied to clipboard

ParsingOperation describes the operations available for parsing Avail message names.

Link copied to clipboard

The statistics for ParsingOperation.

Link copied to clipboard

Permute the elements of the list phrase on the top of the stack via the specified permutation. The list phrase must be the same size as the permutation.

Link copied to clipboard

Placeholder for use by an InstructionGenerator. Must not survive beyond code generation.

Link copied to clipboard

These are the tokens that are understood directly by the Avail compiler.

Link copied to clipboard

A macro has been parsed up to a section checkpoint (§). Make a copy of the parse stack, then perform the equivalent of an AppendArgument on the copy, the specified number of times minus one (because zero is not a legal operand). Make it into a single list phrase and push it onto the original parse stack. It will be consumed by a subsequent RunPrefixFunction.

Link copied to clipboard
Link copied to clipboard

Reverse the operand top elements of the stack. The new stack has the same depth as the old stack.

Link copied to clipboard

A macro has been parsed up to a section checkpoint (§), and a copy of the cleaned up parse stack has been pushed, so invoke the operandth prefix function associated with the macro. Consume the previously pushed copy of the parse stack. The current ParserState's client data map is stashed in the new fiber's globals map and retrieved afterward, so the prefix function and macros can alter the scope or communicate with each other by manipulating this map. This technique prevents chatter between separate fibers (i.e., parsing can still be done in parallel) and between separate linguistic abstractions (the keys are atoms and are therefore modular).

Link copied to clipboard

Push the current parse position onto the mark stack.

Link copied to clipboard

The kinds of manifest entries that can be recorded. If this changes in a way other than adding enum values at the end, you must rebuild your repository files.

Link copied to clipboard

Use the type of the argument just parsed to select among successor message bundle trees. Those message bundle trees are filtered by the allowable leaf argument type. This test is precise, and requires repeated groups to be unrolled for the tuple type specific to that argument slot of that definition, or at least until the A_Type.defaultType of the tuple type has been reached.

Link copied to clipboard

Pop operand arguments from the parse stack of the current potential message send. Create an operand-element list with them, and push the list back onto the parse stack.