compiler

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 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 JSONDump

func JSONDump(v any) string

JSONDump is for debugging purposes only!

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) 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(
	src string,
	mainPkgName string,
	dstPath string,
) error

Compile compiles given rawBuild to target language and uses specified backend to emit files to the destination.

func (Compiler) CompileToIR

func (c Compiler) CompileToIR(
	wd string,
	mainPkgPath string,
) (*ir.Program, *Error)

type Desugarer

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

type Error

type Error struct {
	Err      error
	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 IRGenerator

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

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 irgen implements IR generation from source code.
Package irgen implements IR generation from source code.
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