Documentation

Index

Constants

View Source
const (
	EXT_PROGRAM_SOURCE  = ".xtc"
	EXT_ASSEMBLY_SOURCE = ".s"
	EXT_OBJECT_FILE     = ".o"
	EXT_STATIC_LIBRARY  = ".a"
	EXT_SHARED_LIBRARY  = ".so"
	EXT_EXECUTABLE_FILE = ""
)
View Source
const (
	LOG_DEBUG = iota
	LOG_INFO
	LOG_WARN
	LOG_ERROR
)
View Source
const (
	PLATFORM_X86_LINUX = iota
	PLATFORM_AMD64_LINUX
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorHandler

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

func NewErrorHandler

func NewErrorHandler(level int) *ErrorHandler

func (*ErrorHandler) Debug

func (self *ErrorHandler) Debug(v ...interface{})

func (*ErrorHandler) Debugf

func (self *ErrorHandler) Debugf(format string, v ...interface{})

func (*ErrorHandler) Error

func (self *ErrorHandler) Error(v ...interface{})

func (*ErrorHandler) ErrorOccured

func (self *ErrorHandler) ErrorOccured() bool

func (*ErrorHandler) Errorf

func (self *ErrorHandler) Errorf(format string, v ...interface{})

func (*ErrorHandler) Fatal

func (self *ErrorHandler) Fatal(v ...interface{})

func (*ErrorHandler) Fatalf

func (self *ErrorHandler) Fatalf(format string, v ...interface{})

func (*ErrorHandler) GetErrors

func (self *ErrorHandler) GetErrors() int

func (*ErrorHandler) Info

func (self *ErrorHandler) Info(v ...interface{})

func (*ErrorHandler) Infof

func (self *ErrorHandler) Infof(format string, v ...interface{})

func (*ErrorHandler) Panic

func (self *ErrorHandler) Panic(v ...interface{})

func (*ErrorHandler) Panicf

func (self *ErrorHandler) Panicf(format string, v ...interface{})

func (*ErrorHandler) Warn

func (self *ErrorHandler) Warn(v ...interface{})

func (*ErrorHandler) Warnf

func (self *ErrorHandler) Warnf(format string, v ...interface{})

type IAssembly

type IAssembly interface {
	AsAssembly() IAssembly
	IsInstruction() bool
	IsLabel() bool
	IsDirective() bool
	IsComment() bool
	CollectStatistics(IStatistics)
	ToSource(ISymbolTable) string
}

type IAssemblyCode

type IAssemblyCode interface {
	ToSource() string
}

type IBinaryOpNode

type IBinaryOpNode interface {
	IExprNode
	GetOperator() string
	GetLeft() IExprNode
	GetRight() IExprNode
	SetLeft(IExprNode)
	SetRight(IExprNode)
}

type ICompositeType

type ICompositeType interface {
	INamedType
	GetMember(string) ISlot
	GetMembers() []ISlot
	GetMemberType(string) IType
	GetMemberOffset(string) int
	GetMemberTypes() []IType
	HasMember(string) bool
}

type ICompositeTypeDefinition

type ICompositeTypeDefinition interface {
	ITypeDefinition
	IsCompositeType() bool
	GetMembers() []ISlot
}

type IEntity

type IEntity interface {
	String() string
	GetName() string
	IsDefined() bool
	IsPrivate() bool
	IsConstant() bool
	IsParameter() bool
	IsVariable() bool
	Refered()
	IsRefered() bool
	GetNumRefered() int
	GetTypeNode() ITypeNode
	GetTypeRef() ITypeRef
	GetType() IType
	GetValue() IExprNode
	SymbolString() string
	GetMemref() IMemoryReference
	SetMemref(IMemoryReference)
	GetAddress() IOperand
	SetAddress(IOperand)
}

type IExpr

type IExpr interface {
	AsExpr() IExpr
	GetTypeId() int
	IsVar() bool
	IsAddr() bool
	IsConstant() bool
	GetAsmValue() IImmediateValue
	GetAddress() IOperand
	GetMemref() IMemoryReference
	GetAddressNode(int) IExpr
	GetEntityForce() IEntity
}

type IExprNode

type IExprNode interface {
	INode
	AsExprNode() IExprNode
	GetType() IType
	SetType(IType)
	GetOrigType() IType
	IsConstant() bool
	IsParameter() bool
	IsLvalue() bool
	IsAssignable() bool
	IsLoadable() bool
	IsCallable() bool
	IsPointer() bool
}

type IFunction

type IFunction interface {
	IEntity
	GetReturnType() IType
	IsVoid() bool
	GetCallingSymbol() ISymbol
	SetCallingSymbol(ISymbol)
}

type IImmediateValue

type IImmediateValue interface {
	AsImmediateValue() IImmediateValue
	IOperand
}

type ILiteral

type ILiteral interface {
	AsLiteral() ILiteral
	String() string
	IsZero() bool
	CollectStatistics(IStatistics)
	ToSource(ISymbolTable) string
}

type IMemoryReference

type IMemoryReference interface {
	IOperand
	AsMemoryReference() IMemoryReference
	FixOffset(int64)
}

type INamedType

type INamedType interface {
	IType
	GetName() string
}

type INode

type INode interface {
	String() string
	GetLocation() Location
}

type IOperand

type IOperand interface {
	AsOperand() IOperand
	IsRegister() bool
	IsMemoryReference() bool
	CollectStatistics(IStatistics)
	ToSource(ISymbolTable) string
}

type IRegister

type IRegister interface {
	IOperand
	AsRegister() IRegister
}

type IScope

type IScope interface {
	IsToplevel() bool
	GetToplevel() IScope
	GetParent() IScope
	GetByName(string) IEntity
	CheckReferences(*ErrorHandler)
	AddChild(IScope)
}

type ISlot

type ISlot interface {
	INode
	GetName() string
	GetOffset() int
	GetTypeNode() ITypeNode
	GetTypeRef() ITypeRef
	GetType() IType
}

type IStatistics

type IStatistics interface {
	AsStatistics() IStatistics
	InstructionUsed(string)
	SymbolUsed(ISymbol)
	RegisterUsed(IRegister)
}

type IStmt

type IStmt interface {
	AsStmt() IStmt
	GetLocation() Location
}

type IStmtNode

type IStmtNode interface {
	INode
	AsStmtNode() IStmtNode
	GetScope() IScope
}

type ISymbol

type ISymbol interface {
	ILiteral
	AsSymbol() ISymbol
	GetName() string
}

type ISymbolTable

type ISymbolTable interface {
	AsSymbolTable() ISymbolTable
	SymbolString(ISymbol) string
}

type IType

type IType interface {
	Key() string
	String() string

	Size() int
	AllocSize() int
	Alignment() int

	IsSameType(IType) bool

	IsVoid() bool
	IsInteger() bool
	IsSigned() bool
	IsPointer() bool
	IsArray() bool
	IsCompositeType() bool
	IsStruct() bool
	IsUnion() bool
	IsUserType() bool
	IsFunction() bool

	IsAllocatedArray() bool
	IsIncompleteArray() bool
	IsScalar() bool
	IsCallable() bool

	IsCompatible(IType) bool
	IsCastableTo(IType) bool

	GetBaseType() IType
}

    IType

    type ITypeDefinition

    type ITypeDefinition interface {
    	INode
    	IsTypeDefinition() bool
    	GetName() string
    	GetTypeNode() ITypeNode
    	GetTypeRef() ITypeRef
    	DefiningType() IType
    }

    type ITypeNode

    type ITypeNode interface {
    	INode
    	AsTypeNode() ITypeNode
    	GetTypeRef() ITypeRef
    	IsResolved() bool
    	GetType() IType
    	SetType(IType)
    }

    type ITypeRef

    type ITypeRef interface {
    	Key() string
    	String() string
    
    	GetLocation() Location
    	IsTypeRef() bool
    }

      ITypeRef

      type IUnaryArithmeticOpNode

      type IUnaryArithmeticOpNode interface {
      	IExprNode
      	GetOperator() string
      	GetOpType() IType
      	SetOpType(IType)
      	GetExpr() IExprNode
      	SetExpr(IExprNode)
      	GetAmount() int
      	SetAmount(int)
      }

      type IVariable

      type IVariable interface {
      	IEntity
      }

      type Location

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

      func NewLocation

      func NewLocation(sourceName string, lineNumber int, lineOffset int) Location

      func (Location) GetLineNumber

      func (self Location) GetLineNumber() int

      func (Location) GetLineOffset

      func (self Location) GetLineOffset() int

      func (Location) GetSourceName

      func (self Location) GetSourceName() string

      func (Location) MarshalJSON

      func (self Location) MarshalJSON() ([]byte, error)

      func (Location) String

      func (self Location) String() string

      type Options

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

      func NewOptions

      func NewOptions(name string) *Options

      func ParseOptions

      func ParseOptions(name string, args []string) *Options

      func (*Options) CheckSyntax

      func (self *Options) CheckSyntax() bool

      func (*Options) DumpAST

      func (self *Options) DumpAST() bool

      func (*Options) DumpAsm

      func (self *Options) DumpAsm() bool

      func (*Options) DumpExpr

      func (self *Options) DumpExpr() bool

      func (*Options) DumpIR

      func (self *Options) DumpIR() bool

      func (*Options) DumpReference

      func (self *Options) DumpReference() bool

      func (*Options) DumpSemantic

      func (self *Options) DumpSemantic() bool

      func (*Options) DumpStmt

      func (self *Options) DumpStmt() bool

      func (*Options) DumpTokens

      func (self *Options) DumpTokens() bool

      func (*Options) GetLibraryPath

      func (self *Options) GetLibraryPath() []string

      func (*Options) IsAssembleRequired

      func (self *Options) IsAssembleRequired() bool

      func (*Options) IsCompileRequired

      func (self *Options) IsCompileRequired() bool

      func (*Options) IsGenratingSharedLibrary

      func (self *Options) IsGenratingSharedLibrary() bool

      func (*Options) IsLinkRequired

      func (self *Options) IsLinkRequired() bool

      func (*Options) IsPICRequired

      func (self *Options) IsPICRequired() bool

      func (*Options) IsPIERequired

      func (self *Options) IsPIERequired() bool

      func (*Options) IsPositionIndependent

      func (self *Options) IsPositionIndependent() bool

      func (*Options) IsVerboseAsm

      func (self *Options) IsVerboseAsm() bool

      func (*Options) IsVerboseMode

      func (self *Options) IsVerboseMode() bool

      func (*Options) OutputFilename

      func (self *Options) OutputFilename() string

      func (*Options) Parse

      func (self *Options) Parse(args []string) *Options

      func (*Options) PrintAsm

      func (self *Options) PrintAsm() bool

      func (*Options) SourceFiles

      func (self *Options) SourceFiles() []string

      func (*Options) TargetPlatform

      func (self *Options) TargetPlatform() int

      type SourceFile

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

      func NewSourceFile

      func NewSourceFile(name, file, ext string) *SourceFile

      func NewTemporarySourceFile

      func NewTemporarySourceFile(name, ext string, bytes []byte) (*SourceFile, error)

      func (SourceFile) GetName

      func (self SourceFile) GetName() string

      func (SourceFile) GetPath

      func (self SourceFile) GetPath() string

      func (SourceFile) IsAssemblySource

      func (self SourceFile) IsAssemblySource() bool

      func (SourceFile) IsExecutableFile

      func (self SourceFile) IsExecutableFile() bool

      func (SourceFile) IsGenerated

      func (self SourceFile) IsGenerated() bool

      func (SourceFile) IsObjectFile

      func (self SourceFile) IsObjectFile() bool

      func (SourceFile) IsProgramSource

      func (self SourceFile) IsProgramSource() bool

      func (SourceFile) IsSharedLibrary

      func (self SourceFile) IsSharedLibrary() bool

      func (SourceFile) IsStaticLibrary

      func (self SourceFile) IsStaticLibrary() bool

      func (SourceFile) ReadAll

      func (self SourceFile) ReadAll() ([]byte, error)

      func (SourceFile) Remove

      func (self SourceFile) Remove() error

      func (SourceFile) String

      func (self SourceFile) String() string

      func (SourceFile) ToAssemblySource

      func (self SourceFile) ToAssemblySource() *SourceFile

      func (SourceFile) ToExecutableFile

      func (self SourceFile) ToExecutableFile() *SourceFile

      func (SourceFile) ToObjectFile

      func (self SourceFile) ToObjectFile() *SourceFile

      func (SourceFile) ToProgramSource

      func (self SourceFile) ToProgramSource() *SourceFile

      func (SourceFile) ToSharedLibrary

      func (self SourceFile) ToSharedLibrary() *SourceFile

      func (SourceFile) ToStaticLibrary

      func (self SourceFile) ToStaticLibrary() *SourceFile

      func (SourceFile) WriteAll

      func (self SourceFile) WriteAll(bytes []byte) error