transpiler

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IF ifBranchType = iota
	ELSEIF
	ELSE
)
View Source
const (
	VALUE_TYPE_UNKNOWN valueType = "unknown"
	VALUE_TYPE_VOID    valueType = "void"
	VALUE_TYPE_BOOLEAN valueType = "bool"
	VALUE_TYPE_INTEGER valueType = "int"
	VALUE_TYPE_STRING  valueType = "string"
)

Variables

This section is empty.

Functions

func BoolToString

func BoolToString(b bool) string

func IntToString

func IntToString(i int) string

func New

func New() transpiler

Types

type AppCall

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

func (AppCall) Args

func (c AppCall) Args() []string

func (AppCall) Name

func (c AppCall) Name() string

type Condition

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

func (Condition) Condition

func (c Condition) Condition() string

func (Condition) Next

func (c Condition) Next() *Condition

func (Condition) Operator

func (c Condition) Operator() parser.LogicalOperator

type Converter

type Converter interface {
	// Common methods
	StringToString(value string) string
	Dump() (string, error)
	Extension() string

	// Statement methods
	ProgramStart() error
	ProgramEnd() error
	VarDefinition(name string, value string, global bool) error
	VarAssignment(name string, value string, global bool) error
	SliceAssignment(name string, index string, value string, defaultValue string, global bool) error
	FuncStart(name string, params []string, returnTypes []parser.ValueType) error
	FuncEnd() error
	Return(values []ReturnValue) error
	IfStart(condition string) error
	IfEnd() error
	ElseIfStart(condition string) error
	ElseIfEnd() error
	ElseStart() error
	ElseEnd() error
	ForStart() error
	ForIncrementStart() error
	ForIncrementEnd() error
	ForCondition(condition string) error
	ForEnd() error
	Break() error
	Continue() error
	Print(value []string) error
	Panic(value string) error
	WriteFile(path string, content string, append string) error
	Nop() error

	// Expression methods
	UnaryOperation(expr string, operator parser.UnaryOperator, valueType parser.ValueType, valueUsed bool) (string, error)
	BinaryOperation(left string, operator parser.BinaryOperator, right string, valueType parser.ValueType, valueUsed bool) (string, error)
	Comparison(left string, operator parser.CompareOperator, right string, valueType parser.ValueType, valueUsed bool) (string, error)
	LogicalOperation(left string, operator parser.LogicalOperator, right string, valueType parser.ValueType, valueUsed bool) (string, error)
	VarEvaluation(name string, valueUsed bool, global bool) (string, error)
	SliceInstantiation(values []string, valueUsed bool) (string, error)
	SliceEvaluation(name string, index string, valueUsed bool) (string, error)
	SliceLen(name string, valueUsed bool) (string, error)
	StringSubscript(value string, startIndex string, endIndex string, valueUsed bool) (string, error)
	StringLen(value string, valueUsed bool) (string, error)
	Group(value string, valueUsed bool) (string, error)
	FuncCall(name string, args []string, returnTypes []parser.ValueType, valueUsed bool) ([]string, error)
	AppCall(calls []AppCall, valueUsed bool) ([]string, error)
	Input(prompt string, valueUsed bool) (string, error)
	Copy(destination string, source string, valueUsed bool, global bool) (string, error)
	Exists(path string, valueUsed bool) (string, error)
	ReadFile(path string, valueUsed bool) (string, error)
}

type ReturnValue

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

func (ReturnValue) Value

func (rv ReturnValue) Value() string

func (ReturnValue) ValueType

func (rv ReturnValue) ValueType() parser.ValueType

Jump to

Keyboard shortcuts

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