compiler

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 11, 2025 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RX = "$RX"
	RA = "$RA"
	RB = "$RB"

	RET  = "$RET"  // Function return value
	RETF = "$RETF" // Early return flag
	CALL = "$CALL"

	VarPath    = "vars"
	ArgPath    = "args"
	StructPath = "structs"

	MaxCallCounter = 65536
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Compiler

type Compiler struct {
	expressions.ExprVisitor
	statements.StmtVisitor

	Namespace    string
	Scope        string
	DatapackRoot string
	Config       interfaces.ProjectConfig
	Structs      map[string]statements.StructDeclarationStmt

	RX   string
	RA   string
	RB   string
	RET  string
	CALL string

	VarPath    string
	ArgPath    string
	StructPath string
	// contains filtered or unexported fields
}

func NewCompiler

func NewCompiler(
	config interfaces.ProjectConfig,
	headers []interfaces.DatapackHeader,
	libs embed.FS,
) *Compiler

func (*Compiler) Compile

func (c *Compiler) Compile(program parser.Program) error

func (*Compiler) VisitBinary

func (c *Compiler) VisitBinary(b expressions.BinaryExpr) interfaces.IRCode

func (*Compiler) VisitBlock

func (c *Compiler) VisitBlock(stmt statements.BlockStmt) interfaces.IRCode

func (*Compiler) VisitExpression

func (c *Compiler) VisitExpression(stmt statements.ExpressionStmt) interfaces.IRCode

func (*Compiler) VisitFieldAccess

func (c *Compiler) VisitFieldAccess(v expressions.FieldAccessExpr) interfaces.IRCode

func (*Compiler) VisitFunctionCall

func (c *Compiler) VisitFunctionCall(f expressions.FunctionCallExpr) interfaces.IRCode

func (*Compiler) VisitFunctionDeclaration

func (c *Compiler) VisitFunctionDeclaration(stmt statements.FunctionDeclarationStmt) interfaces.IRCode

func (*Compiler) VisitGrouping

func (c *Compiler) VisitGrouping(g expressions.GroupingExpr) interfaces.IRCode

func (*Compiler) VisitIf

func (c *Compiler) VisitIf(stmt statements.IfStmt) interfaces.IRCode

func (*Compiler) VisitList

func (c *Compiler) VisitList(s expressions.ListExpr) interfaces.IRCode

func (*Compiler) VisitLiteral

func (c *Compiler) VisitLiteral(l expressions.LiteralExpr) interfaces.IRCode

func (*Compiler) VisitLogical

func (c *Compiler) VisitLogical(l expressions.LogicalExpr) interfaces.IRCode

func (*Compiler) VisitReturn

func (c *Compiler) VisitReturn(stmt statements.ReturnStmt) interfaces.IRCode

func (*Compiler) VisitScore added in v0.1.0

func (c *Compiler) VisitScore(stmt statements.ScoreStmt) interfaces.IRCode

func (*Compiler) VisitSetReturnFlag added in v0.1.0

func (c *Compiler) VisitSetReturnFlag(stmt statements.SetReturnFlagStmt) interfaces.IRCode

func (*Compiler) VisitSlice

func (c *Compiler) VisitSlice(s expressions.SliceExpr) interfaces.IRCode

func (*Compiler) VisitStruct added in v0.0.14

func (c *Compiler) VisitStruct(s expressions.StructExpr) interfaces.IRCode

func (*Compiler) VisitStructDeclaration

func (c *Compiler) VisitStructDeclaration(stmt statements.StructDeclarationStmt) interfaces.IRCode

func (*Compiler) VisitUnary

func (c *Compiler) VisitUnary(u expressions.UnaryExpr) interfaces.IRCode

func (*Compiler) VisitVariable

func (c *Compiler) VisitVariable(v expressions.VariableExpr) interfaces.IRCode

func (*Compiler) VisitVariableAssignment

func (c *Compiler) VisitVariableAssignment(stmt statements.VariableAssignmentStmt) interfaces.IRCode

func (*Compiler) VisitVariableDeclaration

func (c *Compiler) VisitVariableDeclaration(stmt statements.VariableDeclarationStmt) interfaces.IRCode

func (*Compiler) VisitWhile added in v0.1.0

func (c *Compiler) VisitWhile(stmt statements.WhileStmt) interfaces.IRCode

Jump to

Keyboard shortcuts

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