Implemented commands until helloworld works \o/

This commit is contained in:
Julien Dessaux 2021-09-23 16:14:37 +02:00
parent f86b5724e5
commit 198efceb1f
10 changed files with 244 additions and 45 deletions

View file

@ -16,14 +16,14 @@ func NewInterpreter(f *field.Field, p *pointer.Pointer) *Interpreter {
func (i *Interpreter) Run() int {
for i.p != nil {
if v := i.Step(); v != nil {
if v := i.step(); v != nil {
return *v
}
}
return 0
}
func (i *Interpreter) Step() *int {
func (i *Interpreter) step() *int {
var prev *pointer.Pointer = nil
for p := i.p; p != nil; p = p.Next {
done, v := p.Exec(i.f)