compiler

package
v0.28.2 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: MIT Imports: 8 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(ref string) core.EntityRef

ParseEntityRef assumes string-ref has form of <pkg_name>.<entity_name≥ or just <entity_name>.

func Pointer

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

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

func SaveFilesToDir added in v0.5.0

func SaveFilesToDir(dst string, files map[string][]byte) error

Types

type Analyzer

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

type Backend

type Backend interface {
	Emit(dst string, prog *ir.Program, trace bool) error
}

type Builder added in v0.5.0

type Builder interface {
	Build(ctx context.Context, wd 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 IRGenerator,
	backend Backend,
) Compiler

func (Compiler) Compile

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

type CompilerInput added in v0.26.0

type CompilerInput struct {
	Main   string
	Output string
	Trace  bool
}

type Desugarer

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

type Error

type Error struct {
	Message  string
	Location *src.Location
	Meta     *core.Meta
	// contains filtered or unexported fields
}

func (*Error) Error

func (e *Error) Error() string

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 sourcecode.Build
}

type IRGenerator

type IRGenerator interface {
	Generate(build src.Build, mainpkg string) (*ir.Program, *Error)
}

type Middleend added in v0.26.0

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

func (Middleend) Process added in v0.26.0

func (m Middleend) Process(feResult FrontendResult) (MiddleendResult, *Error)

type MiddleendResult added in v0.26.0

type MiddleendResult struct {
	AnalyzedBuild  sourcecode.Build
	DesugaredBuild sourcecode.Build
	IR             *ir.Program
}

type Parser

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

type RawBuild

type RawBuild struct {
	EntryModRef src.ModuleRef
	Modules     map[src.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.
backend
dot
Package parser implements source code parsing.
Package parser implements source code parsing.
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.
typesystem
Package typesystem implements type-system with generics and structural subtyping.
Package typesystem implements type-system with generics and structural subtyping.

Jump to

Keyboard shortcuts

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