wip: interpreter

This commit is contained in:
2024-01-25 10:57:23 +07:00
parent 8cd8859c85
commit 692babe938
6 changed files with 84 additions and 42 deletions

7
interpreter/go.mod Normal file
View File

@@ -0,0 +1,7 @@
module e1lama/interpreter
go 1.20
replace e1lama/elm => ../core
require e1lama/elm v0.0.0-00010101000000-000000000000

4
interpreter/go.sum Normal file
View File

@@ -0,0 +1,4 @@
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

View File

@@ -0,0 +1,37 @@
package main
import (
"unicode"
"bytes"
"bufio"
"strings"
"strconv"
"os"
"fmt"
"errors"
. "e1lama/elm"
)
func LoadProgramFromBinary(m *Machine, f *os.File) error {
}
func main() {
f, err := os.Open("program.elb")
if err != nil {
fmt.Fprintf(os.Stderr, "[ERR] Couldn't open file: %s\n", err);
os.Exit(1)
}
defer f.Close()
m := Constructor()
err = LoadProgramFromBinary(m, f)
if err != nil {
fmt.Fprintf(os.Stderr, "[ERR] Error reading binary: %s\n", err);
os.Exit(1)
}
m.Run()
}