Commit graph

38 commits

Author SHA1 Message Date
Daniel
719e269cb1
minor lint fixes (#182) 2019-04-10 21:39:19 -07:00
Daniel
01fe30f02a
bug fix for function return and if statement (#160)
* fix a bug where function return instruction is missing with if statement

* remove script cancel context test
2019-03-23 12:59:54 -07:00
Daniel
3c30109cd0
fix bytecode encoding/decoding of builtin modules (#154)
* fix bytecode encoding/decoding of builtin modules

* Bytecode.Decode() to take map[string]objects.Importable

* add objects.ModuleMap

* update docs

* stdlib.GetModuleMap()
2019-03-20 01:28:40 -07:00
Daniel
61890b15cb
module refactor (#148)
* wip

* move print and JSON functions to modules

* builtin functions are not replacable now

* builtin functions are added for default nil symbol table

* importables: builtin modules and source modules

* refactoring runtime tests

* fix tests

* update documentation

* cleanup

* clean up cli

* fix REPL prints
2019-03-18 08:15:26 -07:00
earncef
ebddfd13a7 Added println (#144)
* Added println

* Fixed tests.

* Updated doc

* Fixed doc

* Cleanup

* Added size limit

* Fixed incorrect type

* Cleanup

* Consistent output for print and println
2019-03-16 00:14:22 -07:00
earncef
5d8457a8f6 Removed double indirection for massive performance gains (#140)
* Removed double indirection for performance gains

* Added missing file

* Cleanup

* Remove pointers patch.

* Cleanup

* Removed redundant parenthesis

* FreeVar changed to ObjectPtr and removed OpSetLocalPtr

* Removed truePtr, falsePtr and undefinedPtr

* Cleanup
2019-03-14 01:07:19 -07:00
Daniel
1921d907a6
fix scipt.Variable.Value() bug (#139) 2019-03-13 03:07:06 -07:00
Daniel
b7977a419b
add Compiled.Clone to make them safe for concurrent execution (#134) 2019-03-08 01:10:49 -08:00
Daniel
e93f6f6325
limit max object allocations (#129)
- add object.NumObjects()
- add object allocation limit in VM
- delete objects.Break, objects.Continue, objects.ReturnValue
- add Script.SetMaxAllocs()
- update sandbox documentation
- add some tests
- remove duplicate values in compiled constants (fixes #96)
- option to limit the maximum number of objects in compiled bytecode constants
2019-03-06 17:20:05 -08:00
earncef
c437def4a0 Decoupled stdlib from vm, script and compiler (#126)
* Decoupled stdlib from script

* Decoupled compiler and vm from stdlib

* cleanup

* Docs and cleanup

* main package with and without stdlib

* cleanup

* Update .goreleaser
2019-03-04 10:21:39 -08:00
earncef
880ee04ffe script.Add accepts a CallableFunc value (#124)
* script.Add accepts a CallableFunc value

* moved to FromInterface
2019-03-01 09:28:41 -08:00
Daniel
306055ad65
add helper functions for builtin functions and builtin modules (#122)
* add helper functions for builtin functions and builtin modules

* fix a builtin function bug for modules
2019-02-28 18:41:29 -08:00
earncef
7cc683e867 SetBuiltinFunctions and SetBuiltinModules (#120)
* `SetBuiltinFunctions` and `SetBuiltinModules`

* nil implies no built in functions.

* Additional tests.

* Cleanup

* Updated SetBuiltinFunctions

* Docs updated.
2019-02-28 08:26:25 -08:00
earncef
6ec360c8b7 Fixed panic when bailout is triggered in parser.ParseFile() (#113)
* Fixed panic when bailout is triggered in parser.ParseFile()

* Removed redundant "parse error" prefix for parse errors.
2019-02-25 10:22:45 -08:00
Daniel
3500c686b3
Improvements on compiler/VM error reporting (filename:line:col)
- add type infos to VM error messages
- add 'Name' to UserFunction objects 
- add 'expectErrorString' to VM tests
- replace vm.expectError() with vm.expectErrorString() to make it more explicit
- add source map info to VM error messages
- optimization in function calls
- add file/line/col info to compiler errors
- change stdlib module to be loaded from VM (instead of compiler) so they can be properly loaded after the source is compiled into binary
- VM can take builtin modules optionally
2019-02-20 16:26:11 -08:00
Daniel
9c67444678
Fixes a REPL bug (Issue #91) (#92) 2019-02-10 00:32:37 -08:00
Daniel Kang
eda0495f30 Fix several module-related issues 2019-02-02 22:22:40 -08:00
Daniel Kang
6a663c6360 add script.Compiled.Set function so compiled script can replace value of global variables 2019-02-01 11:09:12 -08:00
Daniel Kang
46c7190109 Script.AddModule() to take *Script not *Compiled 2019-01-30 23:06:00 -08:00
Daniel Kang
edc23cf2f1 working on script modules (WIP) 2019-01-30 21:50:15 -08:00
Daniel Kang
309b03bb30 add more strings functions to text module 2019-01-28 19:30:32 -08:00
Daniel Kang
85da0cdc24 force using TrueValue, FalseValue, UndefinedValue 2019-01-28 13:09:40 -08:00
Daniel Kang
88ba20da4e add Script.DisableBuiltinFunction, Script.DisableStdModule, Script.SetUserModuleLoader functions 2019-01-24 13:08:53 -08:00
Mike Bazuin
d8c83b6578 Moved interfaceToObject from scripts/conversion.go to objects/conversion.go as FromInterface 2019-01-22 21:09:52 +01:00
Daniel Kang
04bb0f5e62 add context to script run 2019-01-20 04:59:43 -08:00
Daniel Kang
a8d838ad3e Compile can take custom stdlibs 2019-01-18 09:19:45 -08:00
Daniel Kang
bff59006d1 add Variable.Error() function 2019-01-18 02:33:23 -08:00
Daniel Kang
8cad04841e add os File functions; add Bytes type 2019-01-18 01:43:46 -08:00
Daniel Kang
40ad7aa1bb Fix undefined value compatibility 2019-01-15 17:21:58 -08:00
Daniel Kang
d1f7baf054 add Variable.IsUndefined() 2019-01-15 17:17:08 -08:00
Daniel Kang
7f9fa836ee add missing comment 2019-01-15 10:15:48 -08:00
Daniel Kang
e1e0e0cb24 fix golint, ineffectassign issues and add some more tests 2019-01-15 10:14:16 -08:00
Daniel Kang
8e56bd8218 add Script.Run() method 2019-01-12 18:25:45 -08:00
Daniel Kang
94b0d52436 add tests for script custom objects 2019-01-11 03:15:31 -08:00
Daniel Kang
27438eea6f update directory package structure 2019-01-11 02:27:28 -08:00
Daniel Kang
53af0d6328 move file and fileset to source package 2019-01-11 01:16:34 -08:00
Daniel Kang
d870ebf72e variable definition (operator ":=") is now required not optional 2019-01-10 22:34:28 -08:00
Daniel Kang
cce71f0cd5 update script package 2019-01-09 12:39:40 -08:00