Documentation ¶
Overview ¶
Package compiler is responsible for orchestrating the different FSPL compilation stages, as well as invoking the LLVM IR compiler.
Index ¶
- type Compiler
- func (this *Compiler) AnalyzeModule(semanticTree *analyzer.Tree, path string, skim bool) (uuid.UUID, error)
- func (this *Compiler) AnalyzeSourceFile(semanticTree *analyzer.Tree, path string, skim bool) (uuid.UUID, error)
- func (this *Compiler) AnalyzeUnit(semanticTree *analyzer.Tree, path string, skim bool) (uuid.UUID, error)
- func (this *Compiler) CompileIRModule(module *llvm.Module, filetype string) error
- func (this *Compiler) CompileUnit(address entity.Address) error
- func (this *Compiler) FindBackend(filetype string) (string, []string, error)
- func (this *Compiler) ParseModule(syntaxTree *fsplParser.Tree, path string, skim bool) error
- func (this *Compiler) ParseSourceFile(syntaxTree *fsplParser.Tree, path string, skim bool) error
- func (this *Compiler) ParseUnit(syntaxTree *fsplParser.Tree, path string, skim bool) error
- type Resolver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Compiler ¶
func (*Compiler) AnalyzeModule ¶
func (*Compiler) AnalyzeSourceFile ¶
func (*Compiler) AnalyzeUnit ¶
func (*Compiler) CompileIRModule ¶
func (*Compiler) FindBackend ¶
FindBackend returns the name of an LLVM backend command, and a list of arguments to pass to it. It tries commands in this order:
- llc
- llc-<latest> -> llc-14
- clang
If none were found, it returns an error.
func (*Compiler) ParseModule ¶
func (*Compiler) ParseSourceFile ¶
type Resolver ¶
type Resolver struct { // FS specifies a filesystem to search. FS fs.FS // Path specifies a list of paths that a unit may exist directly in. The // Resolver will search the FS for each path listed, starting at the // first and ending at the last. Thus, paths nearer the start will have // a higher priority. Path []string }
Resolver turns addresses into absolute filepaths.
func NewResolver ¶
NewResolver creates a new resolver with os.DirFS("/").
func (*Resolver) AddPathFront ¶
AddPathFront adds one or more items to the beginning of the resolver's search path.
func (Resolver) Resolve ¶
Resolve resolves an address into an absolute filepath starting at the filesystem root. It follows these rules:
- If the address starts with '.', '..', it is joined with context
- If the address starts with '/', it is treated as an absolute path from the fs root
- Else, the address is searched for in the resolver's paths
Click to show internal directories.
Click to hide internal directories.