Commit graph

38 commits

Author SHA1 Message Date
daniel
c88a5f506e
some code clean up (#237) 2019-12-20 11:40:38 -08:00
earncef
0440786b8d Fixed missing ObjectPtr check in OpSetSelLocal (#194)
* fixes #193

* Cleanup
2019-04-25 21:32:42 -07:00
Jacob R. McCollum
adcf05d26f add variadic function parameters (#189)
* parsing variable function types

* finished variadic functions

* fix case where number of passed args to variadic function is 0

* remove extraneous OpVarArgs

* allow multiple variables in variadic function declaration

* fix IdentList string method to print multi-arg variadic functions correctly

* round 2 of fix IdentList string method to print multi-arg variadic functions correctly

round 2 of fix IdentList string method to print multi-arg variadic functions correctly

* clean up tasks in OpCall handling, add tests for variadic closures

* cleanup for pr

- add syntax documentation
- cleanup parseIdentList
- cleanup OpCall handling for functions and closures
- cleanup tests
2019-04-25 21:28:27 -07:00
Daniel
719e269cb1
minor lint fixes (#182) 2019-04-10 21:39:19 -07:00
Daniel
17a50b7c50
fix #171 (#172) 2019-04-01 08:02:11 -07:00
Daniel
8dc0d7b591
fix script timeout bug (#170)
* fix an edge case where script timeout is too short and set even before VM starts execution

* vm.StackObjects() -> v.IsStackEmpty()
2019-03-31 23:37:30 -07:00
earncef
09f3d52265 Opbinaryop and other minor optimizations (#157)
* OpBinaryOp for performance

* Cleanup

* Remove ip limit check in every iteration of the loop.

* Micro optimizations on frequent ops

* Micro optimizations

* Patches

* Removed redundant binaryop operators from compiler

* Merged OpReturn and OpReturnValue

* Cleanup
2019-03-22 04:42:34 -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
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
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
46884c7b25 Removed redundant code in the VM with no performance loss. (#132)
* Removed redundant code in the VM with no performance loss.

* binaryOp is not exported

* minor update
2019-03-05 13:53:14 -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
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
6dd573c3f6 Runtime error trace format (#111)
* Runtime error format

* Parser and Compiler error formats updated
2019-02-22 13:39:07 -08:00
earncef
f265f1702b Stack trace for errors (#108)
* Simple strack trace for runtime errors.

* Module test for runtime error stack trace

* Removed OpExport

* Removed redundant code.

* Removed vm.FrameInfo()
2019-02-21 09:40:17 -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
earncef
5e21abfd74 IndexGet of Array, Index, ImmutableIndex, Bytes, String, Undefined 2019-02-09 16:45:21 -08:00
Daniel Kang
5713eb64fe Fix a slicing expression bug: allow low-index == len(a) 2019-02-02 23:11:02 -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
64d99807d8 remove unused code for tuple value return 2019-01-30 02:01:44 -08:00
Daniel Kang
85da0cdc24 force using TrueValue, FalseValue, UndefinedValue 2019-01-28 13:09:40 -08:00
Daniel Kang
85001be9b8 implement immutable array and map 2019-01-25 14:54:58 -08:00
Daniel Kang
19498da491 adding immutable value (incomplete) 2019-01-24 19:31:17 -08:00
Daniel Kang
2486457fdf add Iterable interface 2019-01-23 13:36:03 -08:00
Daniel Kang
1045afd5a4 add Indexable / IndexAssignable interface 2019-01-22 15:44:37 -08:00
Daniel Kang
336fbc30e5 some performance optimization in VM 2019-01-20 08:32:12 -08:00
Daniel Kang
88dd0224d5 use atomic.Load/Store to avoid data race 2019-01-20 06:33:22 -08:00
Daniel Kang
8cad04841e add os File functions; add Bytes type 2019-01-18 01:43:46 -08:00
Daniel Kang
3f55a6b5b0
Modules (#5)
Implement module imports
2019-01-17 01:56:05 -08:00
Daniel Kang
8171d58071
Error Object (#4)
add error expression and error object
2019-01-16 12:23:20 -08:00
Daniel Kang
b79fd4f7ef
Fix lint issues (#2)
* addressing golint issues

* fix all lint issues.
2019-01-14 22:24:33 -08:00
Daniel Kang
32df2862b5 remove unnecessary function calls in VM 2019-01-14 04:32:09 -08:00
Daniel Kang
de70f7c40d trying to optimize VM by cutting some repeated codes 2019-01-13 15:21:19 -08:00
Daniel Kang
ca128af33b reduce number of memory allocation in object binary operators 2019-01-13 14:24:39 -08:00
Daniel Kang
967ed03ccc fix a bug in tail-call optimization code 2019-01-13 02:24:32 -08:00
Daniel Kang
b802132c94 remove VM.Stack() function 2019-01-11 21:50:23 -08:00
Daniel Kang
27438eea6f update directory package structure 2019-01-11 02:27:28 -08:00
Renamed from vm/vm.go (Browse further)