compiler

package
v0.41.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseEntityRef added in v0.5.0

func ParseEntityRef(ctx context.Context, ref string) (core.EntityRef, error)

ParseEntityRef calls Neva and marshals result into core.EntityRef.

func Pointer

func Pointer[T any](v T) *T

Pointer allows to avoid creating of temporary variables just to take pointers.

Types

type Analyzer

type Analyzer interface {
	Analyze(mod src.Build, mainPkgName string) (src.Build, *Error)
}

type Backend

type Backend interface {
	EmitExecutable(dst string, prog *ir.Program, trace bool) error
	EmitLibrary(dst string, exports []LibraryExport, trace bool) error
}

type Builder added in v0.5.0

type Builder interface {
	Build(ctx context.Context, workdir string) (RawBuild, string, *Error)
}

type Compiler

type Compiler struct {
	// contains filtered or unexported fields
}

func New

func New(
	builder Builder,
	parser Parser,
	desugarer Desugarer,
	analyzer Analyzer,
	irgen Irgen,
	backend Backend,
) Compiler

func (Compiler) Compile

func (c Compiler) Compile(ctx context.Context, input CompilerInput) (*CompilerOutput, error)

type CompilerInput added in v0.26.0

type CompilerInput struct {
	MainPkgPath   string
	OutputPath    string
	Mode          Mode
	EmitTraceFile bool
}

type CompilerOutput added in v0.32.0

type CompilerOutput struct {
	FrontEnd FrontendResult
}

CompilerOutput contains results of compilation. For now it only exposes frontend result, but can be extended.

type Desugarer

type Desugarer interface {
	Desugar(build src.Build) (src.Build, error)
}

type Error

type Error struct {
	Meta *core.Meta

	Message string
	// contains filtered or unexported fields
}

func (*Error) Error

func (e *Error) Error() string

func (Error) Unwrap added in v0.30.2

func (e Error) Unwrap() *Error

func (Error) Wrap added in v0.6.3

func (e Error) Wrap(child *Error) *Error

type Frontend added in v0.26.0

type Frontend struct {
	// contains filtered or unexported fields
}

func NewFrontend added in v0.26.0

func NewFrontend(builder Builder, parser Parser) Frontend

func (Frontend) Process added in v0.26.0

func (f Frontend) Process(ctx context.Context, main string) (FrontendResult, *Error)

type FrontendResult added in v0.26.0

type FrontendResult struct {
	MainPkg     string
	RawBuild    RawBuild
	ParsedBuild ast.Build
	Path        string
}

type Irgen added in v0.29.0

type Irgen interface {
	Generate(build src.Build, mainPkgName string) (*ir.Program, error)
	GenerateForComponent(build src.Build, pkgName, componentName string) (*ir.Program, error)
}

type LibraryExport added in v0.33.0

type LibraryExport struct {
	Program   *ir.Program
	Name      string
	Component src.Component
}

type Middleend added in v0.26.0

type Middleend struct {
	// contains filtered or unexported fields
}

func (Middleend) ProcessExecutable added in v0.33.0

func (m Middleend) ProcessExecutable(feResult FrontendResult) (*ir.Program, *Error)

func (Middleend) ProcessLibrary added in v0.33.0

func (m Middleend) ProcessLibrary(feResult FrontendResult) ([]LibraryExport, *Error)

type Mode added in v0.33.0

type Mode string
const (
	ModeExecutable Mode = "executable"
	ModeLibrary    Mode = "library"
)

type Parser

type Parser interface {
	ParseModules(rawMods map[core.ModuleRef]RawModule) (map[core.ModuleRef]src.Module, *Error)
}

type RawBuild

type RawBuild struct {
	Modules     map[core.ModuleRef]RawModule
	EntryModRef core.ModuleRef
}

type RawModule

type RawModule struct {
	Packages map[string]RawPackage
	Manifest src.ModuleManifest
}

type RawPackage

type RawPackage map[string][]byte

Directories

Path Synopsis
Package analyzer implements source code static semantic analysis.
Package analyzer implements source code static semantic analysis.
backend
ir
Package parser implements source code parsing.
Package parser implements source code parsing.
Package typesystem implements type-system with generics and structural subtyping.
Package typesystem implements type-system with generics and structural subtyping.
utils
generated
Code generated by Neva v0.41.0.
Code generated by Neva v0.41.0.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL