Table of Contents

Class MuLangCompiler

Namespace
MuLang.Compiler
Assembly
MuLang.Compiler.dll

Compiles MuLang source code into runtime-independent portable IR.

public static class MuLangCompiler
Inheritance
MuLangCompiler
Inherited Members

Methods

Analyze(string, EnvironmentSchema, CompilationMode, MuLangCompilationOptions?)

Analyzes MuLang source code using the specified compilation options without producing portable IR.

public static AnalysisResult Analyze(string source, EnvironmentSchema environment, CompilationMode compilationMode, MuLangCompilationOptions? options = null)

Parameters

source string

The MuLang source code.

environment EnvironmentSchema

The environment schema available to the analyzed code.

compilationMode CompilationMode

The compilation mode.

options MuLangCompilationOptions

The analysis options, or null to use Default.

Returns

AnalysisResult

The analysis result.

Exceptions

ArgumentNullException

Thrown when source or environment is null.

ArgumentException

Thrown when the source document URI is not absolute, or the result type or language version is incompatible with the analysis settings.

ArgumentOutOfRangeException

Thrown when compilationMode is not defined.

Analyze(string, EnvironmentSchema, CompilationMode, TypeSymbol?, LanguageProfile?)

Analyzes MuLang source code using the specified compilation settings without producing portable IR.

[Obsolete("Use Analyze(string, EnvironmentSchema, CompilationMode, MuLangCompilationOptions) instead.")]
public static AnalysisResult Analyze(string source, EnvironmentSchema environment, CompilationMode compilationMode, TypeSymbol? expectedResultType = null, LanguageProfile? profile = null)

Parameters

source string

The MuLang source code.

environment EnvironmentSchema

The environment schema available to the analyzed code.

compilationMode CompilationMode

The compilation mode.

expectedResultType TypeSymbol

The expected result type, or null to infer an expression result or use void for a program.

profile LanguageProfile

The language profile, or null to use Latest.

Returns

AnalysisResult

The analysis result.

Exceptions

ArgumentNullException

Thrown when source or environment is null.

ArgumentOutOfRangeException

Thrown when compilationMode is not defined.

ArgumentException

Thrown when the result type or language version is incompatible with the analysis settings.

Classify(string, LanguageProfile?)

Classifies MuLang source text using the specified language profile.

public static ClassificationResult Classify(string source, LanguageProfile? profile = null)

Parameters

source string

The MuLang source code.

profile LanguageProfile

The language profile, or null to use Latest.

Returns

ClassificationResult

The lexical classification result.

Exceptions

ArgumentNullException

Thrown when source is null.

ClassifySemantically(string, EnvironmentSchema, CompilationMode, TypeSymbol?, LanguageProfile?)

Classifies MuLang identifiers using binding information from the specified compilation settings.

public static SemanticClassificationResult ClassifySemantically(string source, EnvironmentSchema environment, CompilationMode compilationMode, TypeSymbol? expectedResultType = null, LanguageProfile? profile = null)

Parameters

source string

The MuLang source code.

environment EnvironmentSchema

The environment schema available to the classified code.

compilationMode CompilationMode

The compilation mode.

expectedResultType TypeSymbol

The expected result type, or null to infer an expression result or use void for a program.

profile LanguageProfile

The language profile, or null to use Latest.

Returns

SemanticClassificationResult

The semantic classification result.

Exceptions

ArgumentNullException

Thrown when source or environment is null.

ArgumentOutOfRangeException

Thrown when compilationMode is not defined.

ArgumentException

Thrown when the result type or language version is incompatible with the classification settings.

Compile(string, EnvironmentSchema, CompilationMode, MuLangCompilationOptions?)

Compiles MuLang source code using the specified compilation options.

public static CompilationResult Compile(string source, EnvironmentSchema environment, CompilationMode compilationMode, MuLangCompilationOptions? options = null)

Parameters

source string

The MuLang source code.

environment EnvironmentSchema

The environment schema available to the compiled code.

compilationMode CompilationMode

The compilation mode.

options MuLangCompilationOptions

The compilation options, or null to use Default.

Returns

CompilationResult

The compilation result.

Exceptions

ArgumentNullException

Thrown when source or environment is null.

ArgumentException

Thrown when the source document URI is not absolute, or the result type or language version is incompatible with the compilation settings.

ArgumentOutOfRangeException

Thrown when compilationMode is not defined.

Compile(string, EnvironmentSchema, CompilationMode, TypeSymbol?, LanguageProfile?)

Compiles MuLang source code using the specified compilation settings.

[Obsolete("Use Compile(string, EnvironmentSchema, CompilationMode, MuLangCompilationOptions) instead.")]
public static CompilationResult Compile(string source, EnvironmentSchema environment, CompilationMode compilationMode, TypeSymbol? expectedResultType = null, LanguageProfile? profile = null)

Parameters

source string

The MuLang source code.

environment EnvironmentSchema

The environment schema available to the compiled code.

compilationMode CompilationMode

The compilation mode.

expectedResultType TypeSymbol

The expected result type, or null to infer an expression result or use void for a program.

profile LanguageProfile

The language profile, or null to use Latest.

Returns

CompilationResult

The compilation result.

Exceptions

ArgumentNullException

Thrown when source or environment is null.

ArgumentOutOfRangeException

Thrown when compilationMode is not defined.

ArgumentException

Thrown when the result type or language version is incompatible with the compilation settings.

GetHover(string, EnvironmentSchema, CompilationMode, int, MuLangCompilationOptions?)

Gets semantic hover information at a Unicode scalar offset.

public static HoverInfo? GetHover(string source, EnvironmentSchema environment, CompilationMode compilationMode, int offset, MuLangCompilationOptions? options = null)

Parameters

source string

The MuLang source code.

environment EnvironmentSchema

The environment schema available to the source code.

compilationMode CompilationMode

The compilation mode.

offset int

The zero-based Unicode scalar offset.

options MuLangCompilationOptions

The analysis options, or null to use Default.

Returns

HoverInfo

The hover information, or null when no resolved symbol covers the offset.

Exceptions

ArgumentNullException

Thrown when source or environment is null.

ArgumentOutOfRangeException

Thrown when the offset is outside the source or the compilation mode is not defined.

ArgumentException

Thrown when the source document URI, result type, or language version is incompatible with the analysis settings.

GetSemanticDocument(string, EnvironmentSchema, CompilationMode, MuLangCompilationOptions?)

Gets the resolved semantic model for MuLang source code.

public static SemanticDocumentResult GetSemanticDocument(string source, EnvironmentSchema environment, CompilationMode compilationMode, MuLangCompilationOptions? options = null)

Parameters

source string

The MuLang source code.

environment EnvironmentSchema

The environment schema available to the source code.

compilationMode CompilationMode

The compilation mode.

options MuLangCompilationOptions

The analysis options, or null to use Default.

Returns

SemanticDocumentResult

The resolved semantic document.

Exceptions

ArgumentNullException

Thrown when source or environment is null.

ArgumentException

Thrown when the source document URI, result type, or language version is incompatible with the analysis settings.

ArgumentOutOfRangeException

Thrown when compilationMode is not defined.