-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathatlas.jsh
28 lines (23 loc) · 814 Bytes
/
atlas.jsh
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
import xyz.leutgeb.lorenz.atlas.*;
import xyz.leutgeb.lorenz.atlas.ast.*;
import xyz.leutgeb.lorenz.atlas.module.Loader;
import xyz.leutgeb.lorenz.atlas.util.*;
import static xyz.leutgeb.lorenz.atlas.Tree.leaf;
import static xyz.leutgeb.lorenz.atlas.Tree.node;
import static xyz.leutgeb.lorenz.atlas.util.Util.readProperties;
readProperties(Path.of("atlas.properties"));
Loader loader = Loader.atDefaultHome();
loader.autoload();
Path compile(String source) {
try {
Program program = loader.loadInline(source);
Path temporary = Files.createTempFile("atlas", ".jsh");
program.dumpToJsh(temporary);
return temporary;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
void loaded() {
loader.getFunctionDefinitions().keySet().stream().sorted().forEach(System.out::println);
}