compiler

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExternDirective    src.Directive = "extern"
	BindDirective      src.Directive = "bind"
	AutoportsDirective src.Directive = "autoports"
)

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
	EmitTraceFile bool
	Mode          Mode
}

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 {
	Message string
	Meta    *core.Meta
	// 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 {
	Name      string
	Component src.Component
	Program   *ir.Program
}

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 {
	EntryModRef core.ModuleRef
	Modules     map[core.ModuleRef]RawModule
}

type RawModule

type RawModule struct {
	Manifest src.ModuleManifest    // Manifest must be parsed by builder before passing into compiler
	Packages map[string]RawPackage // Packages themselves on the other hand can be parsed by compiler
}

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.
ast
This package defines source code entities - abstractions that end-user (a programmer) operates on.
This package defines source code entities - abstractions that end-user (a programmer) operates on.
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.32.0.
Code generated by Neva v0.32.0.

Jump to

Keyboard shortcuts

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