blob: 3f6c8a7afafdd44a9679a755e54b5de99c2563c6 (
plain)
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
|
package org.zwobble.couscous.backends.csharp;
import org.zwobble.couscous.Backend;
import org.zwobble.couscous.ast.ClassNode;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import static org.zwobble.couscous.util.ExtraLists.list;
public class CsharpBackend implements Backend {
private final Path directoryPath;
private final String namespace;
public CsharpBackend(Path directoryPath, String namespace) {
this.directoryPath = directoryPath;
this.namespace = namespace;
}
@Override
public void compile(List<ClassNode> classes) throws IOException {
Files.write(directoryPath.resolve("Program.cs"), list(
"namespace " + namespace + "{" +
" class Program {" +
" public static string run() {" +
" return \"T\";" +
" }" +
" }" +
"}"
));
}
}
|