- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgoscript.go
More file actions
Latest commit
25 lines (21 loc) · 406 Bytes
/
Copy pathgoscript.go
File metadata and controls
25 lines (21 loc) · 406 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package main
import (
"fmt"
"log"
"os"
)
funcmain() {
iflen(os.Args) <2 {
fmt.Printf("Usage: %s <file>\n", os.Args[0])
return
}
fileContent, fileErr:=os.ReadFile(os.Args[1])
iffileErr!=nil {
log.Fatal(fileErr)
}
src:=string(fileContent)
scn:=CreateScanner(src)
astParser:=CreateParser(scn.lexemes)
env:=CreateEnvironment(nil)
EvaluateNodes(astParser.astNodes, env)
}