interpreter

package module
v0.0.0-...-12f2ca1 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2021 License: MIT Imports: 11 Imported by: 0

README

interpreter

Interpreter for acnolang

Example usage

package main
import "github.com/acnologla/interpreter"

func main(){
  interpreter.Run("print('Hello world')", map[string]interface{}{})
}

More examples

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Change

func Change(varname string, value interface{})

func Init

func Init(params map[string]interface{})

func Interpret

func Interpret(token *Token, params map[string]interface{}) interface{}

func Run

func Run(code string, params map[string]interface{}) interface{}

Types

type AsyncFn

type AsyncFn struct {
	Compound interface{}
	Async    bool
}

type AwaitCall

type AwaitCall struct {
	Params interface{}
	Await  bool
}

type Lexem

type Lexem struct {
	Type  int
	Value string
}

func Lex

func Lex(code string) []*Lexem

type Parser

type Parser struct {
	Lexems []*Lexem
	Error  string
	I      int
}

func (*Parser) AccComparators

func (this *Parser) AccComparators() *Token

func (*Parser) AccID

func (this *Parser) AccID() *Token

func (*Parser) AccLogicOperators

func (this *Parser) AccLogicOperators() *Token

func (*Parser) Add

func (this *Parser) Add() *Token

func (*Parser) Compound

func (this *Parser) Compound() (tokens []*Token)

func (*Parser) CreateToken

func (this *Parser) CreateToken(left interface{}, value string, right interface{}) *Token

func (*Parser) Current

func (this *Parser) Current() *Lexem

func (*Parser) Eat

func (this *Parser) Eat(lexemType int) *Lexem

func (*Parser) Expr

func (this *Parser) Expr() *Token

func (*Parser) Factor

func (this *Parser) Factor() *Token

func (*Parser) JumpBreaks

func (this *Parser) JumpBreaks()

func (*Parser) Mult

func (this *Parser) Mult() *Token

func (*Parser) Parse

func (this *Parser) Parse() *Token

type Token

type Token struct {
	Left  interface{}
	Value string
	Right interface{}
}

func Parse

func Parse(lexems []*Lexem) *Token

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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