This commit is contained in:
Chuck Smith
2024-01-21 11:41:17 -05:00
parent 13c9062fed
commit 6bb06370bb
4 changed files with 87 additions and 11 deletions

View File

@@ -17,6 +17,7 @@ const (
ERROR_OBJ = "ERROR"
FUNCTION_OBJ = "FUNCTION"
STRING_OBJ = "STRING"
BUILTIN_OBJ = "BUILTIN"
)
type Object interface {
@@ -119,3 +120,16 @@ func (s *String) Type() ObjectType {
func (s *String) Inspect() string {
return s.Value
}
type BuiltinFunction func(args ...Object) Object
type Builtin struct {
Fn BuiltinFunction
}
func (b Builtin) Type() ObjectType {
return BUILTIN_OBJ
}
func (b Builtin) Inspect() string {
return "builtin function"
}