gentee

package module
Version: v1.20.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2020 License: MIT Imports: 8 Imported by: 0

README

Gentee script programming language

Build Status Go Report Card GoDoc

Gentee is a free open source script programming language. The Gentee programming language is designed to create scripts to automate repetitive actions and processes on your computer. If you use or plan to use .bat files, bash, PowerShell or special programs to automate actions, then try doing the same thing with Gentee.

Want to see a sample application that successfully uses the Gentee programming language? Take a look at Eonza, a free cross-platform program for easy creation and management of scripts.

Documentation

All documentation is available on GitHub.

Download

You can download other binary distributions for Linux, macOS, Windows here.

Go integration

You can use the Gentee compiler and virtual machine in golang projects without any restrictions.
Documentation is available here.

How to run Gentee scripts

$ go get -u github.com/gentee/gentee
$ cd gentee/gentee/cli
$ go build
  • Specify the script file when running gentee. The script file can have any extension.
Linux: ./gentee myscript.g 
Wndows: gentee.exe myscript.g
  • Also, you can associate the gentee program with script files in your operating system.
Gentee compiler/interpreter

gentee [-ver] [-t] <scriptname> [command-line parameters for script]

By default, the program prints the output of the script to the console and returns 0 if successful.

Command line parameters
  • scriptname - full or relative path to the script file. You can specify the command line parameters for the script after the script file name.
  • -ver - show the current version of Gentee language.
  • -t - test the script. When using this parameter, the script must have the result parameter in the header with the expected value (example). In this mode, the program does not output the result of the script execution to the console. If the result does not match, an error message is displayed and an error code 4 is returned.
Error code
Code Description
1 The script file was not found.
2 Compilation error.
3 Runtime Error.
4 The result is erroneous at start with the -t parameter.

Support

If you have any questions and suggestions or would like to help in the development, add your issue here.

License

MIT

Copyright (c) 2018-present, Alexey Krivonogov

Documentation

Index

Constants

View Source
const (
	SysSuspend   = vm.SysSuspend
	SysResume    = vm.SysResume
	SysTerminate = vm.SysTerminate
)

Variables

This section is empty.

Functions

func Customize added in v1.7.0

func Customize(custom *Custom) error

func Gentee2GoType added in v1.10.0

func Gentee2GoType(gval interface{}, gtype ...string) interface{}

Gentee2GoType converts Gentee type to go standard type

func Go2GenteeType added in v1.10.0

func Go2GenteeType(goval interface{}, gtype ...string) (interface{}, error)

Go2GenteeType converts go type to gentee type

func Version added in v1.7.0

func Version() string

Version returns the current version of the Gentee compiler.

Types

type Custom added in v1.7.0

type Custom struct {
	Embedded []EmbedItem
}

Custom is a structure with parameters for compiling and runtime

type EmbedItem added in v1.7.0

type EmbedItem struct {
	Prototype string
	Object    interface{}
}

EmbedItem is a structure for declaration of embedded functions.

type Exec added in v1.6.0

type Exec struct {
	*core.Exec
}

Exec is a structure with a bytecode that is ready to run

func (*Exec) Run added in v1.6.0

func (exec *Exec) Run(settings Settings) (interface{}, error)

Run executes the bytecode.

type Gentee

type Gentee struct {
	*core.Workspace
}

Gentee is a common structure for compiling and executing Gentee source code

func New

func New() *Gentee

New creates a new Gentee workspace

func (*Gentee) Compile

func (g *Gentee) Compile(input, path string) (*Exec, int, error)

Compile compiles the Gentee source code. The function returns bytecode, id of the compiled unit and error code.

func (*Gentee) CompileAndRun added in v1.6.0

func (g *Gentee) CompileAndRun(filename string) (interface{}, error)

CompileAndRun compiles the specified Gentee source file and run it.

func (*Gentee) CompileFile

func (g *Gentee) CompileFile(filename string) (*Exec, int, error)

CompileFile compiles the specified Gentee source file. The function returns bytecode, id of the compiled unit and error code.

func (*Gentee) Unit

func (g *Gentee) Unit(unitID int) Unit

Unit returns the unit structure by its index.

type Progress added in v1.15.0

type Progress = vm.Progress

type ProgressFunc added in v1.15.0

type ProgressFunc = vm.ProgressFunc

type Settings added in v1.6.0

type Settings struct {
	vm.Settings
}

Settings is a structure with parameters for running bytecode

type Unit added in v1.6.0

type Unit struct {
	*core.Unit
}

Unit is a structure describing source code unit

Source Files

Directories

Path Synopsis
tests

Jump to

Keyboard shortcuts

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