nitro

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2021 License: MIT Imports: 9 Imported by: 0

README

Nitro

Nitro is a computer language.

Notes

Using antlr version 4.9.2

Documentation

Index

Constants

View Source
const (
	OpUMinus = vm.OpUMinus
	OpAdd    = vm.OpAdd
	OpSub    = vm.OpSub
	OpMult   = vm.OpMult
	OpDiv    = vm.OpDiv
	OpMod    = vm.OpMod
	OpLT     = vm.OpLT
	OpLE     = vm.OpLE
	OpGT     = vm.OpGT
	OpGE     = vm.OpGE
	OpEq     = vm.OpEq
	OpNE     = vm.OpNE
)

Variables

View Source
var (
	True  = vm.True
	False = vm.False
)
View Source
var ErrCannotCallNil = vm.ErrCannotCallNil

Functions

func CoerceToBool

func CoerceToBool(v Value) bool

func IsIterable

func IsIterable(v Value) bool

func IsReadable

func IsReadable(v Value) bool

func NewInvalidUsageError

func NewInvalidUsageError(expected string) error

func TypeName

func TypeName(v Value) string

Types

type Array

type Array = vm.Array

func NewArray

func NewArray() *Array

func NewArrayFromSlice

func NewArrayFromSlice(s []Value) *Array

type BaseValue

type BaseValue = vm.BaseValue

type Bool

type Bool = vm.Bool

func NewBool

func NewBool(v bool) Bool

type Callable

type Callable = vm.Callable

type CloseFn

type CloseFn = vm.CloseFn

type Closure

type Closure = vm.Closure

type Compiler

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

func NewCompiler

func NewCompiler(fileLoader FileLoader) *Compiler

func (*Compiler) AddNativeFn

func (c *Compiler) AddNativeFn(name string, fn vm.NativeFn)

func (*Compiler) Compile

func (c *Compiler) Compile(
	filename string,
	errLogger errlogger.ErrLogger,
) (*vm.Program, error)

func (*Compiler) CompileInline

func (c *Compiler) CompileInline(
	inline string,
	errLogger errlogger.ErrLogger,
) (*vm.Program, error)

func (*Compiler) RegisterNativeModuleLoader

func (c *Compiler) RegisterNativeModuleLoader(name string, regFn func(r NativeModuleContext))

func (*Compiler) SetDiag

func (c *Compiler) SetDiag(diag bool)

type ErrLogger

type ErrLogger = errlogger.ErrLogger

func NewConsoleErrLogger

func NewConsoleErrLogger() ErrLogger

type ExternFn

type ExternFn = vm.NativeFn

type FileLoader

type FileLoader interface {
	LoadFile(name string) ([]byte, error)
}

func NewNativeFileLoader

func NewNativeFileLoader() FileLoader

type Float

type Float = vm.Float

func NewFloat

func NewFloat(v float64) Float

type Frame

type Frame = vm.FrameInfo

type FrameCrumb

type FrameCrumb = vm.FrameCrumb

type Func

type Func = vm.Fn

type Indexable

type Indexable = vm.Indexable

type Int

type Int = vm.Int

func NewInt

func NewInt(v int64) Int

type Iterable

type Iterable = vm.Iterable

type Iterator

type Iterator = vm.Iterator

func MakeIterator

func MakeIterator(m *VM, v Value) (Iterator, error)

func NewIterator

func NewIterator(f ExternFn, c CloseFn, nret int) Iterator

type Metadata

type Metadata = meta.Metadata

type NativeFn

type NativeFn = vm.NativeFn

type NativeModuleContext

type NativeModuleContext = ast.NativeModuleContext

type Object

type Object = vm.Object

func NewObject

func NewObject() *Object

type Op

type Op = vm.Op

type Pos

type Pos = token.Pos

type Program

type Program = vm.Program

type Readable

type Readable = vm.Readable

type Reader

type Reader = vm.Reader

func MakeReader

func MakeReader(m *VM, v Value) (Reader, error)

type Regex

type Regex = vm.Regex

func NewRegex

func NewRegex(r *regexp.Regexp) *Regex

type RuntimeError

type RuntimeError = vm.RuntimeError

type String

type String = vm.String

func NewString

func NewString(v string) String

type VM

type VM = vm.VM

func NewVM

func NewVM(p *Program) *VM

type Value

type Value = vm.Value

func EvalOp

func EvalOp(op Op, operand1, operand2 Value) (Value, error)

type ValueRef

type ValueRef = vm.ValueRef

func NewValueRef

func NewValueRef(ref *Value) ValueRef

Directories

Path Synopsis
cmd
internal
ast
std
vm
lib

Jump to

Keyboard shortcuts

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