Done with the book! Added hash maps and the puts builtin.
Signed-off-by: jmug <u.g.a.mariano@gmail.com>
This commit is contained in:
parent
fa9f450278
commit
fb25a86b91
11 changed files with 373 additions and 0 deletions
|
|
@ -1,12 +1,21 @@
|
|||
package evaluator
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"code.jmug.me/jmug/interpreter-in-go/pkg/object"
|
||||
)
|
||||
|
||||
var builtins = map[string]*object.Builtin{
|
||||
"puts": {
|
||||
Fn: func(args ...object.Object) object.Object {
|
||||
for _, arg := range args {
|
||||
fmt.Println(arg.Inspect())
|
||||
}
|
||||
return _NULL
|
||||
},
|
||||
},
|
||||
"len": {
|
||||
Fn: func(args ...object.Object) object.Object {
|
||||
if len(args) != 1 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue