VM and compiler update (#63)

* renamed test folders and fixed bug where wrong jump labels would be exectuted for rewrite.

* Added support for Osize (len(string)) and factored out the array tests

* Added current instruction number to VM prompt if program is loaded.

* added support for unary expressions.

* updated README of and sorted the help commands

* updated readme of the compiler

* bumped version -> 0.39.0
This commit is contained in:
Anthony De Meulemeester 2018-04-04 21:41:19 +02:00 committed by GitHub
parent 83e467e527
commit 941bd7e728
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 475 additions and 292 deletions

View file

@ -72,6 +72,9 @@ func (e *Element) BigInt() *big.Int {
// Bool attempts to get the underlying value of the element as a boolean.
// Will panic if the assertion failed which will be catched by the VM.
func (e *Element) Bool() bool {
if v, ok := e.value.Value().(*big.Int); ok {
return v.Int64() == 1
}
return e.value.Value().(bool)
}