-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrye.go
52 lines (43 loc) · 1.03 KB
/
rye.go
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package main
import "os"
import "runtime/pprof"
import rye "github.com/strickyak/rye/runtime"
import MY "github.com/strickyak/rye/compiler/rye_/rye"
var _ = os.Args
func main() {
rye.RememberRyeCompileOptions(``)
ppfile := os.Getenv("RYE_PPROF")
if ppfile != "" {
f, err := os.Create(ppfile)
if err != nil {
panic(err)
}
pprof.StartCPUProfile(f)
defer pprof.StopCPUProfile()
}
defer func() {
// Catch and print FYI for uncaught outer exceptions.
r := recover()
if r != nil {
if rye.DebugExcept < 1 {
rye.DebugExcept = 1
}
rye.PrintStackFYIUnlessEOFBecauseExcept(r)
panic(r)
}
}()
defer rye.Flushem()
MY.G___name__ = rye.MkStr("__main__")
MY.Eval_Module()
// // This code was for interp:
// glbl := rye.MkDict(make(rye.Scope))
// for k, ptr := range MY.ModuleMap {
// glbl.SetItem(rye.MkStr(k), *ptr)
// }
// interp.Eval_Module()
// sco := interp.G_0_Scopes().(*interp.C_Scopes)
// sco.M_g = glbl
// interp.G_1_Repl(sco)
MY.G_1_main(rye.MkStrs(os.Args[1:]))
rye.Shutdown()
}