Skip to content

Commit

Permalink
🚚 Run --> Interpreter
Browse files Browse the repository at this point in the history
  • Loading branch information
grngxd committed May 31, 2022
1 parent 528d622 commit d4d0e67
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
10 changes: 7 additions & 3 deletions run/run.go → Interpreter/Interpreter.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,19 @@ func Run(filePath string) {
fmt.Println(args[1 : len(args)-1])
// It's checking if the variable exists in the map.
} else {
// every key in the map is a string.
found_var := false

for key := range variables {
if key == args {
fmt.Println(variables[key])
found_var = true
}
}

if !found_var {
fmt.Printf("Error: Variable \"%s\" Not Found\n", args)
}
}
}
}

os.WriteFile("variables.txt", []byte(fmt.Sprintf("%v", variables)), 0644)
}
4 changes: 2 additions & 2 deletions main.aoki
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
hi = "heyyo"
print hi
// test_var = "This is a testing variable :)"
print test_var
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
run "aoki/run"
interpreter "aoki/interpreter"
"fmt"
"os"
"strings"
Expand All @@ -13,7 +13,7 @@ func main() {
if len(args) != 0 {
if args[0] == "run" {
if len(args[1]) != 0 && strings.HasSuffix(args[1], ".aoki") {
run.Run(args[1])
interpreter.Run(args[1])
} else {
fmt.Println("Please specify a .aoki file.")
}
Expand Down
1 change: 0 additions & 1 deletion variables.txt

This file was deleted.

0 comments on commit d4d0e67

Please sign in to comment.